Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BannedEventArgs"/> class.
 /// </summary>
 /// <param name="target">The banned player.</param>
 /// <param name="issuer">The issuer player.</param>
 /// <param name="details">The ban details.</param>
 /// <param name="type"><inheritdoc cref="Type"/></param>
 public BannedEventArgs(Player target, Player issuer, BanDetails details, BanHandler.BanType type)
 {
     Target  = target;
     Details = details;
     Type    = type;
     Issuer  = issuer;
 }
Exemplo n.º 2
0
 public static void Postfix(BanDetails ban, BanHandler.BanType banType)
 {
     try
     {
         Events.InvokePlayerBanned(ban, banType);
     }
     catch (Exception exception)
     {
         Log.Error($"PlayerBannedEvent error: {exception}");
     }
 }
Exemplo n.º 3
0
        private static void Postfix(BanDetails ban, BanHandler.BanType banType)
        {
            var ev = new BannedEventArgs(string.IsNullOrEmpty(ban.Id) ? null : API.Features.Player.Get(ban.Id), ban, banType);

            Player.OnBanned(ev);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BannedEventArgs"/> class.
 /// </summary>
 /// <param name="player">The banned player.</param>
 /// <param name="details">The ban details.</param>
 /// <param name="type"><inheritdoc cref="Type"/></param>
 public BannedEventArgs(Player player, BanDetails details, BanHandler.BanType type)
 {
     Player  = player;
     Details = details;
     Type    = type;
 }
        public static async Task <bool> IssueBan(string userID, string userName, string adminID, string durationinseconds, BanHandler.BanType type)
        {
            using (HttpClient client = new HttpClient())
            {
                string typeofban = "-1";
                if (type == BanHandler.BanType.UserId)
                {
                    typeofban = "0";
                }
                else if (type == BanHandler.BanType.IP)
                {
                    typeofban = "1";
                }
                var webRequest = await client.GetAsync("https://bans.kingsplayground.fun/issueban.php?KEY=" + Plugin.APIKey + "&STEAMID=" + userID + "&USERNAME="******"&AID=" + adminID + "&TYPE=" + typeofban + "&DURATION=" + durationinseconds);

                if (!webRequest.IsSuccessStatusCode)
                {
                    Log.Error("Web API connection error in IssueBan(): " + webRequest.StatusCode + " - " + webRequest.Content.ReadAsStringAsync());
                    return(false);
                }

                string apiResponse = await webRequest.Content.ReadAsStringAsync();

                if (apiResponse.Contains("OK"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 6
0
 public static void Postfix(BanDetails ban, BanHandler.BanType banType) => Events.InvokePlayerBanned(ban, banType);
Exemplo n.º 7
0
 private static void Prefix(BanDetails ban, BanHandler.BanType banType, out string __state)
 {
     __state = ban.Issuer;
 }