Exemplo n.º 1
0
 public bool SetClientId(Client client)
 {
     if (!Server.DatabaseSetClientId(client))
     {
         client.Kick("You are already on server!");
         return false;
     }
     return true;
 }
Exemplo n.º 2
0
        public override void RemoveClient(Client client, string reason = "")
        {
            client.Kick(reason);

            PlayersToRemove.Add(client);
        }
Exemplo n.º 3
0
        public override void AddClient(Client client)
        {
            // -- We assume the Client is a GameJolt or the Client's password is correct and no one is using the Client's name.

            if (IsGameJoltIdUsed(client as P3DPlayer))
            {
                client.Kick("You are already on server!");
                return;
            }
            SavePlayerGJ(client as P3DPlayer);


            ClientUpdate(client, true);


            // Send to player his Id
            client.SendPacket(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
            // Send to player all Players Id
            foreach (var aClient in Server.GetAllClients())
            {
                client.SendPacket(new CreatePlayerPacket { Origin = -1, PlayerId = aClient.Id });
                var packet = aClient.GetDataPacket();
                packet.Origin = aClient.Id;
                client.SendPacket(packet);
            }
            // Send to Players player Id
            SendPacketToAll(new CreatePlayerPacket { Origin = -1, PlayerId = client.Id });
            var p = client.GetDataPacket();
            p.Origin = client.Id;
            SendPacketToAll(p);


            ClientConnected(client);


            base.AddClient(client);
        }
Exemplo n.º 4
0
        public override void AddClient(Client client)
        {
            if (!Server.DatabaseSetClientId(client))
            {
                client.Kick("You are already on server!");
                return;
            }

            ClientUpdate(client, true);

            client.SendPacket(new AuthorizationCompletePacket { PlayerId = new VarInt(client.Id) });

            PlayersToAdd.Add(client);
            PlayersJoining.Remove(client);
        }