Пример #1
0
        public static void Ban(this Client client, string Reason, Client IssuedBy = null)
        {
            Ban ban = new Ban()
            {
                Address = client.NetConnection.RemoteEndPoint.Address.ToString(),
                BannedBy = IssuedBy == null ? "Server" : IssuedBy.DisplayName,
                Reason = Reason,
                TimeIssued = DateTime.Now,
                Name = client.DisplayName
            };

            lock (Lists._banned.BannedIps) Lists._banned.BannedIps.Add(ban);
            try {
                client.GetAccount().Ban = ban;
            } catch (Exception ex) {
                Console.WriteLine(string.Format("Ban of player \"{0}\" failed!", client.DisplayName ));
            }
        }
Пример #2
0
        public static void Ban(this Client client, string Reason, Client IssuedBy = null)
        {
            Ban ban = new Ban()
            {
                Address = client.NetConnection.RemoteEndPoint.Address.ToString(),
                BannedBy = IssuedBy == null ? "Server" : IssuedBy.DisplayName,
                Reason = Reason,
                TimeIssued = DateTime.Now,
                Name = client.DisplayName,
            };

            lock (Lists._banned.BannedIps) Lists._banned.BannedIps.Add(ban);

            client.GetAccount().Ban = ban;
        }