/// <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; }
public static void Postfix(BanDetails ban, BanHandler.BanType banType) { try { Events.InvokePlayerBanned(ban, banType); } catch (Exception exception) { Log.Error($"PlayerBannedEvent error: {exception}"); } }
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); }
/// <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); } } }
public static void Postfix(BanDetails ban, BanHandler.BanType banType) => Events.InvokePlayerBanned(ban, banType);
private static void Prefix(BanDetails ban, BanHandler.BanType banType, out string __state) { __state = ban.Issuer; }