Beispiel #1
0
        private void ListenerCycle()
        {
            try
            {
                while (true) // Listener.Stop() will stop it.
                {
                    var client = new P3DPlayer(Listener.AcceptSocket(), this);
                    client.Ready        += OnClientReady;
                    client.Disconnected += OnClientLeave;
                    client.StartListening();

                    lock (JoiningClients)
                        JoiningClients.Add(client);
                }
            }
            catch (Exception e) when(e is SocketException)
            {
            }
        }
Beispiel #2
0
        private bool IsGameJoltIDUsed(P3DPlayer player)
        {
            if (!player.IsGameJoltPlayer)
            {
                return(false);
            }

            lock (Clients)
            {
                foreach (var client in Clients)
                {
                    if (client != null && client != player && client.IsGameJoltPlayer && player.GameJoltID == client.GameJoltID)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #3
0
        /// <summary>
        /// There is a possibility that someone was banned with existing id and chnaged his name. GJ allows it.
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        private (bool IsBanned, BanTable BanTable) BanStatusGJ(P3DPlayer client)
        {
            var table = Database.DatabaseGetAll <BanTable>().FirstOrDefault(banTable => Database.DatabaseGetAll <ClientGJTable>().Where(gjTable => gjTable.GameJoltID == client.GameJoltID).Any(table1 => banTable.ClientID == table1.ClientID));

            return(table != null ? (true, table) : (false, null));
        }