Example #1
0
 private void ProcessUnban(IPlayer player, JObject clan)
 {
     foreach (var member in clan["members"])
     {
         var target = covalence.Players.FindPlayerById(Convert.ToString(member));
         if (type == 1)
         {
             EnhancedBanSystem.Call("TryUnBan", player.Name, new string[1] {
                 target.Id
             });
         }
         else
         {
             var exists = ServerUsers.Get(ulong.Parse(target.Id));
             if (exists != null && exists.group != ServerUsers.UserGroup.Banned)
             {
                 SendMessage(player, GetLang("AlreadyUnbanned", player.Id, target.Name));
                 return;
             }
             ServerUsers.Remove(ulong.Parse(target.Id));
             ServerUsers.Save();
             server.Broadcast(GetLang("PlayerUnbanned", null, target.Name));
         }
     }
     if (AnnounceToServer)
     {
         server.Broadcast(GetLang("UnbanMessage", null, clan["tag"]));
     }
 }
Example #2
0
 private void ProcessUnban(IPlayer player, JObject clan)
 {
     foreach (var member in clan["members"])
     {
         var target = covalence.Players.FindPlayerById(Convert.ToString(member));
         if (type == 1)
         {
             EnhancedBanSystem.Call("TryUnBan", player.Name, new string[1] {
                 target.Id
             });
         }
         else
         {
             if (!target.IsBanned)
             {
                 SendMessage(player, GetLang("AlreadyUnbanned", player.Id, target.Name));
                 return;
             }
             target.Unban();
             server.Broadcast(GetLang("PlayerUnbanned", null, target.Name));
         }
     }
     if (AnnounceToServer)
     {
         server.Broadcast(GetLang("UnbanMessage", null, clan["tag"]));
     }
 }
Example #3
0
        private void ProcessBan(IPlayer player, JObject clan, string reason)
        {
            string reason1 = "CLAN BAN (" + clan["tag"] + ") : " + reason;

            foreach (var member in clan["members"])
            {
                var target = covalence.Players.FindPlayerById(Convert.ToString(member));
                if (type == 1)
                {
                    EnhancedBanSystem.Call("BanPlayer", player.Name, target, reason1, 0.0);
                }
                if (type == 2)
                {
                    var exists = ServerUsers.Get(ulong.Parse(target.Id));
                    if (exists != null && ServerUsers.Get(ulong.Parse(target.Id)).group == ServerUsers.UserGroup.Banned)
                    {
                        SendMessage(player, GetLang("AlreadyBanned", player.Id, target.Name));
                        return;
                    }
                    ServerUsers.Set(ulong.Parse(target.Id), ServerUsers.UserGroup.Banned, target.Name, reason1);
                    ServerUsers.Save();
                    server.Broadcast(GetLang("PlayerBanned", null, target.Name, reason));
                    if (target.IsConnected)
                    {
                        target.Kick(reason);
                    }
                }
                if (type == 3)
                {
                    DiscordMessages.Call("ExecuteBan", target, player, reason1);
                }
            }
            if (AnnounceToServer)
            {
                server.Broadcast(GetLang("BanMessage", null, clan["tag"], reason));
            }
        }