/// <summary>Puts a client into the specified lobby (specified in the packet). The client is not connected if the lobby is full.
        /// If the client is connected, update the lobby list and player list for all other clients.</summary>
        /// <param name="clientID">The client identifier.</param>
        /// <param name="packet">The incoming packet.</param>
        /// <remarks>This function sends a "PlayerList" packet.</remarks>
        /// <remarks>This function sends a "LobbyList" packet.</remarks>
        public static void ClientLobbyJoin(int clientID, Packet packet)
        {
            int id      = packet.ReadInt();
            int lobbyID = packet.ReadInt();

            var lobby  = GameServer.openLobbies[lobbyID];
            var player = GameServer.connectedClients[id];

            if (!lobby.IsFull)
            {
                player.LobbyID = lobbyID;
                lobby.AddPlayer(player);

                PacketSend.PlayerList(lobbyID);
                PacketSend.LobbyList();
            }

            ValidatePlayerID(clientID, id);
        }
        /// <summary>Disconnect the client from the server, notify other users of this event, and reset the state of this client instance.
        /// If the client was in a lobby, check to see if that lobby is not empty. If so, delete the lobby.</summary>
        /// <param name="clientID">The clients unique ID</param>
        /// <remarks> This function sends a "PlayerList" packet.</remarks>
        /// <remarks> This function sends a "PlayerGameOver" packet.</remarks>
        /// <remarks> This function sends a "LobbyList" packet.</remarks>
        /// <remarks> This function sends a "PlayerCountChange" packet.</remarks>
        public void Disconnect()
        {
            Console.WriteLine(Constants.PLAYER_DISSCONECTED + UserName);
            tcp.Disconnect();

            if (LobbyID != -1)
            {
                PacketSend.PlayerList(LobbyID);
                PacketSend.PlayerGameOver(LobbyID, UID, true);

                GameServer.openLobbies[LobbyID].RemovePlayer(this);
            }

            PacketSend.LobbyList();
            PacketSend.PlayerCountChange(UID);

            UserName = null;
            Status   = 0;
            LobbyID  = -1;
        }