From 19f8b68c1c9e9d228f1790c675dc9f76934993ac Mon Sep 17 00:00:00 2001 From: Dawid Bepierszcz <41084667+daffyyyy@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:05:20 +0200 Subject: [PATCH] 1.4.3a - New feature permban permission (@css/permban) - CustomCommand fix - Version checker - Minor changes - Updated to CounterStrikeSharp 225 - Bump version to 1.4.3a --- CS2-SimpleAdmin.cs | 44 ++++++++++++---------- CS2-SimpleAdmin.csproj | 2 +- Commands/basebans.cs | 52 ++++++++++++-------------- Commands/basechat.cs | 8 ++-- Commands/basecommands.cs | 32 ++++++++-------- Commands/basecomms.cs | 70 +++++++++++++++++------------------ Commands/basevotes.cs | 18 ++++----- Commands/funcommands.cs | 12 +++--- Commands/playercommands.cs | 68 +++++++++++++++++----------------- Config.cs | 38 +++++++++---------- Database/Database.cs | 8 ++-- Database/Migration.cs | 7 +--- Events.cs | 65 ++++++++++++++++++--------------- Helper.cs | 73 +++++++++++++++++++++++++++++++++---- Managers/AdminSQLManager.cs | 2 +- Managers/BanManager.cs | 2 +- Managers/MuteManager.cs | 2 +- Menus/ManageServerMenu.cs | 4 +- VERSION | 1 + lang/ar.json | 5 +-- lang/en.json | 5 +-- lang/es.json | 5 +-- lang/fa.json | 5 +-- lang/fr.json | 5 +-- lang/lv.json | 5 +-- lang/pl.json | 5 +-- lang/pt-BR.json | 5 +-- lang/ru.json | 5 +-- lang/tr.json | 5 +-- lang/zh-Hans.json | 5 +-- 30 files changed, 308 insertions(+), 255 deletions(-) create mode 100644 VERSION diff --git a/CS2-SimpleAdmin.cs b/CS2-SimpleAdmin.cs index 19b330a..88875ba 100644 --- a/CS2-SimpleAdmin.cs +++ b/CS2-SimpleAdmin.cs @@ -17,27 +17,28 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig voteAnswers = []; - private static ConcurrentBag godPlayers = []; - private static ConcurrentBag silentPlayers = []; - private static ConcurrentBag bannedPlayers = []; - private static bool TagsDetected; - public static bool voteInProgress = false; + public static readonly Dictionary VoteAnswers = []; + private static readonly ConcurrentBag GodPlayers = []; + private static readonly ConcurrentBag SilentPlayers = []; + private static readonly ConcurrentBag BannedPlayers = []; + private static bool _tagsDetected; + private static bool _adminsLoaded; + public static bool VoteInProgress = false; public static int? ServerId = null; - public static DiscordWebhookClient? _discordWebhookClientLog; - public static DiscordWebhookClient? _discordWebhookClientPenalty; + public static DiscordWebhookClient? DiscordWebhookClientLog; + public static DiscordWebhookClient? DiscordWebhookClientPenalty; - internal string dbConnectionString = string.Empty; - internal static Database? _database; + private string _dbConnectionString = string.Empty; + private static Database.Database? _database; internal static ILogger? _logger; - public static MemoryFunctionVoid? CBasePlayerControllerSetPawnFunc; + private static MemoryFunctionVoid? _cBasePlayerControllerSetPawnFunc; public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)"); public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)"; public override string ModuleAuthor => "daffyy & Dliix66"; - public override string ModuleVersion => "1.4.2a"; + public override string ModuleVersion => "1.4.3a"; public CS2_SimpleAdminConfig Config { get; set; } = new(); @@ -52,19 +53,21 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig(GameData.GetSignature("CBasePlayerController_SetPawn")); + _cBasePlayerControllerSetPawnFunc = new MemoryFunctionVoid(GameData.GetSignature("CBasePlayerController_SetPawn")); } public void OnConfigParsed(CS2_SimpleAdminConfig config) { + if (config.DatabaseHost.Length < 1 || config.DatabaseName.Length < 1 || config.DatabaseUser.Length < 1) { throw new Exception("[CS2-SimpleAdmin] You need to setup Database credentials in config!"); } - + Instance = this; _logger = Logger; + MySqlConnectionStringBuilder builder = new() { Server = config.DatabaseHost, @@ -77,8 +80,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig bag, int playerSlot) + private static void RemoveFromConcurrentBag(ConcurrentBag bag, int playerSlot) { List tempList = []; while (!bag.IsEmpty) diff --git a/CS2-SimpleAdmin.csproj b/CS2-SimpleAdmin.csproj index 2df19a2..7db2dde 100644 --- a/CS2-SimpleAdmin.csproj +++ b/CS2-SimpleAdmin.csproj @@ -10,7 +10,7 @@ - + diff --git a/Commands/basebans.cs b/Commands/basebans.cs index e8278fb..8019f1f 100644 --- a/Commands/basebans.cs +++ b/Commands/basebans.cs @@ -29,7 +29,7 @@ namespace CS2_SimpleAdmin return; } - Database database = new(dbConnectionString); + Database.Database database = new(_dbConnectionString); BanManager banManager = new(database, Config); int.TryParse(command.GetArg(2), out var time); @@ -84,10 +84,10 @@ namespace CS2_SimpleAdmin AddTimer(Config.KickTime, () => Helper.KickPlayer(player.UserId.Value), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); - if (playerInfo.IpAddress != null && !bannedPlayers.Contains(playerInfo.IpAddress)) - bannedPlayers.Add(playerInfo.IpAddress); - if (!bannedPlayers.Contains(player.SteamID.ToString())) - bannedPlayers.Add(player.SteamID.ToString()); + if (playerInfo.IpAddress != null && !BannedPlayers.Contains(playerInfo.IpAddress)) + BannedPlayers.Add(playerInfo.IpAddress); + if (!BannedPlayers.Contains(player.SteamID.ToString())) + BannedPlayers.Add(player.SteamID.ToString()); if (time == 0) { @@ -97,7 +97,7 @@ namespace CS2_SimpleAdmin player.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -117,7 +117,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_ban_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -134,9 +134,9 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, DiscordWebhookClientPenalty, _localizer); } [ConsoleCommand("css_addban")] @@ -199,7 +199,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -220,7 +220,7 @@ namespace CS2_SimpleAdmin player.PrintToCenter(_localizer!["sa_player_ban_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -235,7 +235,7 @@ namespace CS2_SimpleAdmin } } - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, DiscordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -245,7 +245,7 @@ namespace CS2_SimpleAdmin }); Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); //Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); command.ReplyToCommand($"Banned player with steamid {steamid}."); @@ -271,7 +271,7 @@ namespace CS2_SimpleAdmin return; } - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); var reason = _localizer?["sa_unknown"] ?? "Unknown"; @@ -311,7 +311,7 @@ namespace CS2_SimpleAdmin player.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -331,7 +331,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_ban_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -353,7 +353,7 @@ namespace CS2_SimpleAdmin }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } } - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, DiscordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -363,32 +363,28 @@ namespace CS2_SimpleAdmin }); Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); command.ReplyToCommand($"Banned player with IP address {ipAddress}."); } private bool CheckValidBan(CCSPlayerController? caller, int duration) { - bool validCaller = caller != null && caller.IsValid; + if (caller == null) return true; - bool canPermBan = caller == null || validCaller && AdminManager.PlayerHasPermissions(caller, "@css/permban"); + bool canPermBan = AdminManager.PlayerHasPermissions(caller, "@css/permban"); if (duration > Config.MaxBanDuration && canPermBan == false) { - if (validCaller) - caller.PrintToChat($"{_localizer["sa_prefix"]} {_localizer["sa_ban_max_duration_exceeded", Config.MaxBanDuration]}"); - return false; + caller.PrintToChat($"{_localizer!["sa_prefix"]} {_localizer["sa_ban_max_duration_exceeded", Config.MaxBanDuration]}"); } if (duration == 0 && canPermBan == false) { - if (validCaller) - caller.PrintToChat($"{_localizer!["sa_prefix"]} {_localizer["sa_ban_perm_restricted"]}"); - return false; + caller.PrintToChat($"{_localizer!["sa_prefix"]} {_localizer["sa_ban_perm_restricted"]}"); } - return true; + return caller.IsValid && canPermBan; } [ConsoleCommand("css_unban")] @@ -412,7 +408,7 @@ namespace CS2_SimpleAdmin BanManager banManager = new(_database, Config); Task.Run(async () => await banManager.UnbanPlayer(pattern, callerSteamId, reason)); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); command.ReplyToCommand($"Unbanned player with pattern {pattern}."); diff --git a/Commands/basechat.cs b/Commands/basechat.cs index dc38ebe..e93e6dc 100644 --- a/Commands/basechat.cs +++ b/Commands/basechat.cs @@ -18,7 +18,7 @@ namespace CS2_SimpleAdmin { if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); @@ -46,7 +46,7 @@ namespace CS2_SimpleAdmin var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); var utf8String = Encoding.UTF8.GetString(utf8BytesString); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); foreach (var player in Helper.GetValidPlayers()) @@ -95,7 +95,7 @@ namespace CS2_SimpleAdmin var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); var utf8String = Encoding.UTF8.GetString(utf8BytesString); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); Helper.PrintToCenterAll(utf8String.ReplaceColorTags()); @@ -109,7 +109,7 @@ namespace CS2_SimpleAdmin var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); var utf8String = Encoding.UTF8.GetString(utf8BytesString); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); VirtualFunctions.ClientPrintAll( diff --git a/Commands/basecommands.cs b/Commands/basecommands.cs index d74bbf7..129ee9a 100644 --- a/Commands/basecommands.cs +++ b/Commands/basecommands.cs @@ -133,7 +133,7 @@ namespace CS2_SimpleAdmin _ = adminManager.AddAdminBySteamId(steamid, name, flagsList, immunity, time, globalAdmin); if (command != null) - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, $"css_addadmin {steamid} {name} {flags} {immunity} {time}"); var msg = $"Added '{flags}' flags to '{name}' ({steamid})"; @@ -184,7 +184,7 @@ namespace CS2_SimpleAdmin }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); if (command != null) - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, $"css_deladmin {steamid}"); var msg = $"Removed flags from '{steamid}'"; @@ -231,7 +231,7 @@ namespace CS2_SimpleAdmin _ = adminManager.AddGroup(name, flagsList, immunity); if (command != null) - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, $"css_addgroup {name} {flags} {immunity}"); var msg = $"Created group '{name}' with flags '{flags}'"; @@ -273,7 +273,7 @@ namespace CS2_SimpleAdmin }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); if (command != null) - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, $"css_delgroup {name}"); var msg = $"Removed group '{name}'"; @@ -336,15 +336,15 @@ namespace CS2_SimpleAdmin Helper.LogCommand(caller, command); - if (silentPlayers.Contains(caller.Slot)) + if (SilentPlayers.Contains(caller.Slot)) { - RemoveFromConcurrentBag(silentPlayers, caller.Slot); + RemoveFromConcurrentBag(SilentPlayers, caller.Slot); caller.PrintToChat($"You aren't hidden now!"); caller.ChangeTeam(CsTeam.Spectator); } else { - silentPlayers.Add(caller.Slot); + SilentPlayers.Add(caller.Slot); Server.ExecuteCommand("sv_disable_teamselect_menu 1"); if (caller.PlayerPawn.Value != null && caller.PawnIsAlive) @@ -372,7 +372,7 @@ namespace CS2_SimpleAdmin var playersToTarget = targets.Players.Where(player => player.IsValid && player.SteamID.ToString().Length == 17 && !player.IsHLTV).ToList(); - Database database = new(dbConnectionString); + Database.Database database = new(_dbConnectionString); BanManager banManager = new(database, Config); MuteManager muteManager = new(_database); @@ -498,7 +498,7 @@ namespace CS2_SimpleAdmin reason ??= _localizer?["sa_unknown"] ?? "Unknown"; if (command != null) - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, $"css_kick {player?.PlayerName} {reason}"); if (string.IsNullOrEmpty(reason) == false) @@ -519,7 +519,7 @@ namespace CS2_SimpleAdmin CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } - if (caller != null && (caller.UserId == null || silentPlayers.Contains(caller.Slot))) return; + if (caller != null && (caller.UserId == null || SilentPlayers.Contains(caller.Slot))) return; foreach (var controller in Helper.GetValidPlayers()) { @@ -577,7 +577,7 @@ namespace CS2_SimpleAdmin }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var player in Helper.GetValidPlayers()) { @@ -591,7 +591,7 @@ namespace CS2_SimpleAdmin } if (command == null) return; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); } @@ -612,7 +612,7 @@ namespace CS2_SimpleAdmin var issuedCommand = long.TryParse(map, out var mapId) ? $"host_workshop_map {mapId}" : $"ds_workshop_changelevel {map}"; - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var player in Helper.GetValidPlayers()) { @@ -631,7 +631,7 @@ namespace CS2_SimpleAdmin }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); if (command == null) return; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); } @@ -655,7 +655,7 @@ namespace CS2_SimpleAdmin return; } - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); var value = command.GetArg(2); @@ -673,7 +673,7 @@ namespace CS2_SimpleAdmin { var callerName = caller == null ? "Console" : caller.PlayerName; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); Server.ExecuteCommand(command.ArgString); diff --git a/Commands/basecomms.cs b/Commands/basecomms.cs index 6cdd3be..fc9d943 100644 --- a/Commands/basecomms.cs +++ b/Commands/basecomms.cs @@ -71,7 +71,7 @@ namespace CS2_SimpleAdmin await muteManager.MutePlayer(playerInfo, adminInfo, reason, time); }); - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); PlayerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); @@ -85,7 +85,7 @@ namespace CS2_SimpleAdmin } } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -108,7 +108,7 @@ namespace CS2_SimpleAdmin } } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -123,8 +123,8 @@ namespace CS2_SimpleAdmin } if (command == null) return; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, DiscordWebhookClientPenalty, _localizer); Helper.LogCommand(caller, command); } @@ -185,7 +185,7 @@ namespace CS2_SimpleAdmin player.PrintToCenter(_localizer!["sa_player_gag_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -206,7 +206,7 @@ namespace CS2_SimpleAdmin player.PrintToCenter(_localizer!["sa_player_gag_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -220,13 +220,13 @@ namespace CS2_SimpleAdmin } } - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_mute {player.SteamID}"); PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); } - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, DiscordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -234,7 +234,7 @@ namespace CS2_SimpleAdmin await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time); }); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); command.ReplyToCommand($"Gagged player with steamid {steamid}."); @@ -258,7 +258,7 @@ namespace CS2_SimpleAdmin return; } - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); var found = false; @@ -276,7 +276,7 @@ namespace CS2_SimpleAdmin { PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Gag); - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); found = true; @@ -295,7 +295,7 @@ namespace CS2_SimpleAdmin { PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Gag); - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_unmute {player.SteamID.ToString()}"); pattern = player.SteamID.ToString(); @@ -422,7 +422,7 @@ namespace CS2_SimpleAdmin player.PrintToCenter(_localizer!["sa_player_mute_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -442,7 +442,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_mute_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -458,8 +458,8 @@ namespace CS2_SimpleAdmin if (command != null) { - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer); Helper.LogCommand(caller, command); } } @@ -521,7 +521,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_mute_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -541,7 +541,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_mute_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -556,7 +556,7 @@ namespace CS2_SimpleAdmin } } - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer); } Task.Run(async () => @@ -564,7 +564,7 @@ namespace CS2_SimpleAdmin await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1); }); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); command.ReplyToCommand($"Muted player with steamid {steamid}."); @@ -588,7 +588,7 @@ namespace CS2_SimpleAdmin return; } - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); var pattern = command.GetArg(1); @@ -727,7 +727,7 @@ namespace CS2_SimpleAdmin await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2); }); - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); player!.VoiceFlags = VoiceFlags.Muted; @@ -743,7 +743,7 @@ namespace CS2_SimpleAdmin } } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -766,7 +766,7 @@ namespace CS2_SimpleAdmin } } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -782,8 +782,8 @@ namespace CS2_SimpleAdmin if (command != null) { - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); } } @@ -836,7 +836,7 @@ namespace CS2_SimpleAdmin return; } - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_mute {player.SteamID}"); PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time); @@ -848,7 +848,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_silence_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -868,7 +868,7 @@ namespace CS2_SimpleAdmin { player.PrintToCenter(_localizer!["sa_player_silence_message_time", reason, time, caller == null ? "Console" : caller.PlayerName]); } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -882,7 +882,7 @@ namespace CS2_SimpleAdmin } } - Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); + Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer); } } Task.Run(async () => @@ -890,7 +890,7 @@ namespace CS2_SimpleAdmin await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2); }); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); command.ReplyToCommand($"Silenced player with steamid {steamid}."); @@ -914,7 +914,7 @@ namespace CS2_SimpleAdmin return; } - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); var pattern = command.GetArg(1); @@ -929,7 +929,7 @@ namespace CS2_SimpleAdmin var player = matches.FirstOrDefault(); if (player != null && player.IsValid) { - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Silence); @@ -948,7 +948,7 @@ namespace CS2_SimpleAdmin var player = matches.FirstOrDefault(); if (player != null && player.IsValid) { - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Silence); diff --git a/Commands/basevotes.cs b/Commands/basevotes.cs index f27207a..09eb2cc 100644 --- a/Commands/basevotes.cs +++ b/Commands/basevotes.cs @@ -18,19 +18,19 @@ namespace CS2_SimpleAdmin if (command.ArgCount < 2) return; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); - voteAnswers.Clear(); + VoteAnswers.Clear(); var question = command.GetArg(1); var answersCount = command.ArgCount; - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { for (var i = 2; i <= answersCount - 1; i++) { - voteAnswers.Add(command.GetArg(i), 0); + VoteAnswers.Add(command.GetArg(i), 0); } foreach (var player in Helper.GetValidPlayers()) @@ -55,10 +55,10 @@ namespace CS2_SimpleAdmin } } - voteInProgress = true; + VoteInProgress = true; } - if (voteInProgress) + if (VoteInProgress) { AddTimer(30, () => { @@ -72,7 +72,7 @@ namespace CS2_SimpleAdmin } } - foreach (var (key, value) in voteAnswers) + foreach (var (key, value) in VoteAnswers) { foreach (var player in Helper.GetValidPlayers()) { @@ -84,8 +84,8 @@ namespace CS2_SimpleAdmin } } } - voteAnswers.Clear(); - voteInProgress = false; + VoteAnswers.Clear(); + VoteInProgress = false; }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } } diff --git a/Commands/funcommands.cs b/Commands/funcommands.cs index 73f8e45..f5a7c13 100644 --- a/Commands/funcommands.cs +++ b/Commands/funcommands.cs @@ -21,7 +21,7 @@ namespace CS2_SimpleAdmin player.IsValid && player.SteamID.ToString().Length == 17 && player is { PawnIsAlive: true, IsHLTV: false }).ToList(); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -39,7 +39,7 @@ namespace CS2_SimpleAdmin Helper.LogCommand(caller, $"css_noclip {player.PlayerName}"); - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -62,7 +62,7 @@ namespace CS2_SimpleAdmin var targets = GetTarget(command); var playersToTarget = targets!.Players.Where(player => player is { IsValid: true, PawnIsAlive: true, IsHLTV: false }).ToList(); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -87,7 +87,7 @@ namespace CS2_SimpleAdmin if (time > 0) AddTimer(time, () => player?.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -127,10 +127,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) diff --git a/Commands/playercommands.cs b/Commands/playercommands.cs index 9e80e33..c58c417 100644 --- a/Commands/playercommands.cs +++ b/Commands/playercommands.cs @@ -40,11 +40,11 @@ namespace CS2_SimpleAdmin if (command != null) { - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); Helper.LogCommand(caller, command); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -114,7 +114,7 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } player.GiveNamedItem(weaponName); @@ -125,7 +125,7 @@ namespace CS2_SimpleAdmin { callerName ??= caller == null ? "Console" : caller.PlayerName; - if (caller != null && (silentPlayers.Contains(caller.Slot))) return; + if (caller != null && (SilentPlayers.Contains(caller.Slot))) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -169,10 +169,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -217,10 +217,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -266,10 +266,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -292,7 +292,7 @@ namespace CS2_SimpleAdmin var targets = GetTarget(command); if (targets == null) return; - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); var playersToTarget = targets.Players.Where(player => player.IsValid && player is { PawnIsAlive: true, IsHLTV: false }).ToList(); @@ -317,10 +317,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -366,10 +366,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -412,19 +412,19 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (!godPlayers.Contains(player.Slot)) + if (!GodPlayers.Contains(player.Slot)) { - godPlayers.Add(player.Slot); + GodPlayers.Add(player.Slot); } else { - RemoveFromConcurrentBag(godPlayers, player.Slot); + RemoveFromConcurrentBag(GodPlayers, player.Slot); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -473,10 +473,10 @@ namespace CS2_SimpleAdmin if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -567,7 +567,7 @@ namespace CS2_SimpleAdmin } } - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -582,7 +582,7 @@ namespace CS2_SimpleAdmin if (command == null) return; Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } [ConsoleCommand("css_rename", "Rename a player.")] @@ -600,7 +600,7 @@ namespace CS2_SimpleAdmin var playersToTarget = targets!.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList(); Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -608,7 +608,7 @@ namespace CS2_SimpleAdmin return; if (!caller!.CanTarget(player)) return; - if (caller == null || !silentPlayers.Contains(caller.Slot)) + if (caller == null || !SilentPlayers.Contains(caller.Slot)) { foreach (var controller in Helper.GetValidPlayers()) { @@ -651,20 +651,20 @@ namespace CS2_SimpleAdmin { callerName ??= caller == null ? "Console" : caller.PlayerName; - if (CBasePlayerControllerSetPawnFunc == null || player?.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return; + if (_cBasePlayerControllerSetPawnFunc == null || player?.PlayerPawn.Value == null || !player.PlayerPawn.IsValid) return; var playerPawn = player.PlayerPawn.Value; - CBasePlayerControllerSetPawnFunc.Invoke(player, playerPawn, true, false); + _cBasePlayerControllerSetPawnFunc.Invoke(player, playerPawn, true, false); VirtualFunction.CreateVoid(player.Handle, GameData.GetOffset("CCSPlayerController_Respawn"))(player); if (command != null) { Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); } - if (caller != null && silentPlayers.Contains(caller.Slot)) return; + if (caller != null && SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -693,7 +693,7 @@ namespace CS2_SimpleAdmin var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList(); Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -709,7 +709,7 @@ namespace CS2_SimpleAdmin caller.Pawn.Value!.ToggleNoclip(); }); - if (silentPlayers.Contains(caller.Slot)) return; + if (SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) @@ -738,7 +738,7 @@ namespace CS2_SimpleAdmin var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList(); Helper.LogCommand(caller, command); - Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); + Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer); playersToTarget.ForEach(player => { @@ -754,7 +754,7 @@ namespace CS2_SimpleAdmin caller.Pawn.Value!.ToggleNoclip(); }); - if (silentPlayers.Contains(caller.Slot)) return; + if (SilentPlayers.Contains(caller.Slot)) return; foreach (var controller in Helper.GetValidPlayers()) { using (new WithTemporaryCulture(controller.GetLanguage())) diff --git a/Config.cs b/Config.cs index 77389bf..e6fca08 100644 --- a/Config.cs +++ b/Config.cs @@ -11,7 +11,7 @@ namespace CS2_SimpleAdmin [JsonPropertyName("duration")] public int Duration { get; set; } } - + public class AdminFlag { [JsonPropertyName("name")] @@ -60,7 +60,7 @@ namespace CS2_SimpleAdmin new DurationItem { Name = "30 days", Duration = 60 * 24 * 30 }, new DurationItem { Name = "Permanent", Duration = 0 } ]; - + [JsonPropertyName("BanReasons")] public List BanReasons { get; set; } = [ @@ -70,16 +70,16 @@ namespace CS2_SimpleAdmin "Admin disrespect", "Other" ]; - + [JsonPropertyName("KickReasons")] - public List KickReasons { get; set; } = + public List KickReasons { get; set; } = [ "Voice Abuse", "Chat Abuse", "Admin disrespect", "Other" ]; - + [JsonPropertyName("MuteReasons")] public List MuteReasons { get; set; } = [ @@ -90,7 +90,7 @@ namespace CS2_SimpleAdmin "Admin disrespect", "Other" ]; - + [JsonPropertyName("AdminFlags")] public AdminFlag[] AdminFlags { get; set; } = [ @@ -109,7 +109,7 @@ namespace CS2_SimpleAdmin public class CS2_SimpleAdminConfig : BasePluginConfig { - [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 12; + [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 13; [JsonPropertyName("DatabaseHost")] public string DatabaseHost { get; set; } = ""; @@ -137,33 +137,33 @@ namespace CS2_SimpleAdmin [JsonPropertyName("DisableDangerousCommands")] public bool DisableDangerousCommands { get; set; } = true; - - [JsonPropertyName("MaxBanDuration")] - public int MaxBanDuration { get; set; } = 60 * 24; // 1 day [JsonPropertyName("BanType")] - public int BanType { get; } = 1; + public int BanType { get; set; } = 1; + + [JsonPropertyName("MaxBanDuration")] + public int MaxBanDuration { get; set; } = 60 * 24 * 7; // 7 days [JsonPropertyName("MultiServerMode")] - public bool MultiServerMode { get; } = true; + public bool MultiServerMode { get; set; } = true; [JsonPropertyName("ExpireOldIpBans")] - public int ExpireOldIpBans { get; } = 0; + public int ExpireOldIpBans { get; set; } = 0; [JsonPropertyName("TeamSwitchType")] - public int TeamSwitchType { get; } = 1; + public int TeamSwitchType { get; set; } = 1; [JsonPropertyName("Discord")] - public Discord Discord { get; } = new(); + public Discord Discord { get; set; } = new(); [JsonPropertyName("DefaultMaps")] - public List DefaultMaps { get; } = []; + public List DefaultMaps { get; set; } = []; [JsonPropertyName("WorkshopMaps")] - public List WorkshopMaps { get; } = []; + public List WorkshopMaps { get; set; } = []; [JsonPropertyName("CustomServerCommands")] - public List CustomServerCommands { get; set; } = []; - + public List CustomServerCommands { get; set; } = new(); + [JsonPropertyName("MenuConfig")] public MenuConfig MenuConfigs { get; set; } = new(); } diff --git a/Database/Database.cs b/Database/Database.cs index 2f2659a..fd3f8d0 100644 --- a/Database/Database.cs +++ b/Database/Database.cs @@ -1,17 +1,15 @@ using Microsoft.Extensions.Logging; using MySqlConnector; -namespace CS2_SimpleAdmin; +namespace CS2_SimpleAdmin.Database; public class Database(string dbConnectionString) { - private readonly string _dbConnectionString = dbConnectionString; - public MySqlConnection GetConnection() { try { - var connection = new MySqlConnection(_dbConnectionString); + var connection = new MySqlConnection(dbConnectionString); connection.Open(); return connection; } @@ -27,7 +25,7 @@ public class Database(string dbConnectionString) { try { - var connection = new MySqlConnection(_dbConnectionString); + var connection = new MySqlConnection(dbConnectionString); await connection.OpenAsync(); return connection; } diff --git a/Database/Migration.cs b/Database/Migration.cs index 975580a..56954f4 100644 --- a/Database/Migration.cs +++ b/Database/Migration.cs @@ -1,12 +1,10 @@ using Microsoft.Extensions.Logging; using MySqlConnector; -namespace CS2_SimpleAdmin; +namespace CS2_SimpleAdmin.Database; public class Migration(Database database) { - private readonly Database _database = database; - public void ExecuteMigrations() { var migrationsDirectory = CS2_SimpleAdmin.Instance.ModuleDirectory + "/Database/Migrations"; @@ -14,11 +12,10 @@ public class Migration(Database database) var files = Directory.GetFiles(migrationsDirectory, "*.sql") .OrderBy(f => f); - using var connection = _database.GetConnection(); + using var connection = database.GetConnection(); // Create sa_migrations table if not exists using var cmd = new MySqlCommand(""" - CREATE TABLE IF NOT EXISTS `sa_migrations` ( `id` INT PRIMARY KEY AUTO_INCREMENT, `version` VARCHAR(255) NOT NULL diff --git a/Events.cs b/Events.cs index da100c0..76213ff 100644 --- a/Events.cs +++ b/Events.cs @@ -50,19 +50,19 @@ public partial class CS2_SimpleAdmin { PlayerPenaltyManager.RemoveAllPenalties(player.Slot); - if (TagsDetected) + if (_tagsDetected) { Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); } - if (silentPlayers.Contains(player.Slot)) + if (SilentPlayers.Contains(player.Slot)) { - RemoveFromConcurrentBag(silentPlayers, player.Slot); + RemoveFromConcurrentBag(SilentPlayers, player.Slot); } - if (godPlayers.Contains(player.Slot)) + if (GodPlayers.Contains(player.Slot)) { - RemoveFromConcurrentBag(godPlayers, player.Slot); + RemoveFromConcurrentBag(GodPlayers, player.Slot); } SteamID? authorizedSteamId = player.AuthorizedSteamID; @@ -96,7 +96,7 @@ public partial class CS2_SimpleAdmin var ipAddress = player.IpAddress.Split(":")[0]; // Check if the player's IP or SteamID is in the bannedPlayers list - if (bannedPlayers.Contains(ipAddress) || bannedPlayers.Contains(player.SteamID.ToString())) + if (BannedPlayers.Contains(ipAddress) || BannedPlayers.Contains(player.SteamID.ToString())) { // Kick the player if banned if (player.UserId.HasValue) @@ -130,17 +130,17 @@ public partial class CS2_SimpleAdmin if (isBanned) { // Add player's IP and SteamID to bannedPlayers list if not already present - if (playerInfo.IpAddress != null && !bannedPlayers.Contains(playerInfo.IpAddress)) - bannedPlayers.Add(playerInfo.IpAddress); + if (playerInfo.IpAddress != null && !BannedPlayers.Contains(playerInfo.IpAddress)) + BannedPlayers.Add(playerInfo.IpAddress); - if (playerInfo.SteamId != null && !bannedPlayers.Contains(playerInfo.SteamId)) - bannedPlayers.Add(playerInfo.SteamId); + if (playerInfo.SteamId != null && !BannedPlayers.Contains(playerInfo.SteamId)) + BannedPlayers.Add(playerInfo.SteamId); // Kick the player if banned await Server.NextFrameAsync(() => { var victim = Utilities.GetPlayerFromUserid(playerInfo.UserId); - if (victim.UserId.HasValue) + if (victim?.UserId != null) { Helper.KickPlayer(victim.UserId.Value, "Banned"); } @@ -166,7 +166,7 @@ public partial class CS2_SimpleAdmin PlayerPenaltyManager.AddPenalty(playerInfo.Slot, PenaltyType.Gag, ends, duration); await Server.NextFrameAsync(() => { - if (TagsDetected) + if (_tagsDetected) { Server.ExecuteCommand($"css_tag_mute {playerInfo.SteamId}"); } @@ -184,7 +184,7 @@ public partial class CS2_SimpleAdmin await Server.NextFrameAsync(() => { player.VoiceFlags = VoiceFlags.Muted; - if (TagsDetected) + if (_tagsDetected) { Server.ExecuteCommand($"css_tag_mute {playerInfo.SteamId}"); } @@ -213,7 +213,7 @@ public partial class CS2_SimpleAdmin Logger.LogCritical("[OnRoundEnd]"); #endif - godPlayers.Clear(); + GodPlayers.Clear(); return HookResult.Continue; } @@ -250,7 +250,7 @@ public partial class CS2_SimpleAdmin if (AdminManager.PlayerHasPermissions(player, "@css/chat")) { - sb.Append(_localizer!["sa_adminchat_template_admin", player!.PlayerName, info.GetArg(1).Remove(0, 1)]); + sb.Append(_localizer!["sa_adminchat_template_admin", player.PlayerName, info.GetArg(1).Remove(0, 1)]); foreach (var p in Utilities.GetPlayers().Where(p => p.IsValid && p is { IsBot: false, IsHLTV: false } && AdminManager.PlayerHasPermissions(p, "@css/chat"))) { p.PrintToChat(sb.ToString()); @@ -258,7 +258,7 @@ public partial class CS2_SimpleAdmin } else { - sb.Append(_localizer!["sa_adminchat_template_player", player!.PlayerName, info.GetArg(1).Remove(0, 1)]); + sb.Append(_localizer!["sa_adminchat_template_player", player.PlayerName, info.GetArg(1).Remove(0, 1)]); player.PrintToChat(sb.ToString()); foreach (var p in Utilities.GetPlayers().Where(p => p is { IsValid: true, IsBot: false, IsHLTV: false } && AdminManager.PlayerHasPermissions(p, "@css/chat"))) { @@ -267,7 +267,6 @@ public partial class CS2_SimpleAdmin } return HookResult.Handled; - } private void OnMapStart(string mapName) @@ -275,15 +274,16 @@ public partial class CS2_SimpleAdmin var path = Path.GetDirectoryName(ModuleDirectory); if (Directory.Exists(path + "/CS2-Tags")) { - TagsDetected = true; + _tagsDetected = true; } - godPlayers.Clear(); - silentPlayers.Clear(); + _adminsLoaded = false; + GodPlayers.Clear(); + SilentPlayers.Clear(); PlayerPenaltyManager.RemoveAllPenalties(); - _database = new Database(dbConnectionString); + _database = new Database.Database(_dbConnectionString); AddTimer(61.0f, () => { @@ -313,7 +313,7 @@ public partial class CS2_SimpleAdmin } catch { } - bannedPlayers.Clear(); + BannedPlayers.Clear(); await Server.NextFrameAsync(() => { @@ -326,7 +326,7 @@ public partial class CS2_SimpleAdmin if (!PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag) && !PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Silence)) { - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); } @@ -335,7 +335,7 @@ public partial class CS2_SimpleAdmin PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag)) continue; player.VoiceFlags = VoiceFlags.Normal; - if (TagsDetected) + if (_tagsDetected) Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); } @@ -392,7 +392,7 @@ public partial class CS2_SimpleAdmin try { - var response = await client.GetAsync($"https://api.daffyy.love/index.php{queryString}"); + await client.GetAsync($"https://api.daffyy.love/index.php{queryString}"); } catch (HttpRequestException ex) { @@ -402,12 +402,19 @@ public partial class CS2_SimpleAdmin //await _adminManager.GiveAllGroupsFlags(); //await _adminManager.GiveAllFlags(); - + + if (_adminsLoaded) + return; + await adminManager.CrateGroupsJsonFile(); await adminManager.CreateAdminsJsonFile(); - AdminManager.LoadAdminData(ModuleDirectory + "/data/admins.json"); - AdminManager.LoadAdminGroups(ModuleDirectory + "/data/groups.json"); + await Server.NextFrameAsync(() => { + AdminManager.LoadAdminData(ModuleDirectory + "/data/admins.json"); + AdminManager.LoadAdminGroups(ModuleDirectory + "/data/groups.json"); + }); + + _adminsLoaded = true; }); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); } @@ -420,7 +427,7 @@ public partial class CS2_SimpleAdmin if (player is null || @event.Attacker is null || !player.PawnIsAlive || player.PlayerPawn.Value == null) return HookResult.Continue; - if (!godPlayers.Contains(player.Slot)) return HookResult.Continue; + if (!GodPlayers.Contains(player.Slot)) return HookResult.Continue; player.PlayerPawn.Value.Health = player.PlayerPawn.Value.MaxHealth; player.PlayerPawn.Value.ArmorValue = 100; diff --git a/Helper.cs b/Helper.cs index 11f5056..2f7b5a8 100644 --- a/Helper.cs +++ b/Helper.cs @@ -94,10 +94,8 @@ namespace CS2_SimpleAdmin } if (flags == null) return; - foreach (var flag in flags) + foreach (var flag in flags.Where(flag => !string.IsNullOrEmpty(flag))) { - if (string.IsNullOrEmpty(flag)) continue; - if (flag.StartsWith($"@")) { //Console.WriteLine($"Adding permission {flag} to SteamID {steamid}"); @@ -142,11 +140,11 @@ namespace CS2_SimpleAdmin internal static void HandleVotes(CCSPlayerController player, ChatMenuOption option) { - if (!CS2_SimpleAdmin.voteInProgress) + if (!CS2_SimpleAdmin.VoteInProgress) return; option.Disabled = true; - CS2_SimpleAdmin.voteAnswers[option.Text]++; + CS2_SimpleAdmin.VoteAnswers[option.Text]++; } internal static void LogCommand(CCSPlayerController? caller, CommandInfo command) @@ -323,7 +321,7 @@ namespace CS2_SimpleAdmin public static void TryLogCommandOnDiscord(CCSPlayerController? caller, string commandString) { - if (CS2_SimpleAdmin._discordWebhookClientLog == null || CS2_SimpleAdmin._localizer == null) + if (CS2_SimpleAdmin.DiscordWebhookClientLog == null || CS2_SimpleAdmin._localizer == null) return; if (caller != null && caller.IsValid == false) @@ -333,12 +331,73 @@ namespace CS2_SimpleAdmin var communityUrl = caller != null ? "<" + new SteamID(caller.SteamID).ToCommunityUrl() + ">" : ""; - CS2_SimpleAdmin._discordWebhookClientLog.SendMessageAsync(GenerateMessageDiscord( + CS2_SimpleAdmin.DiscordWebhookClientLog.SendMessageAsync(GenerateMessageDiscord( CS2_SimpleAdmin._localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", commandString])); } } + public static class PluginInfo + { + internal static async Task CheckVersion(string version, ILogger logger) + { + using HttpClient client = new(); + + try + { + var response = await client.GetAsync("https://raw.githubusercontent.com/daffyyyy/CS2-SimpleAdmin/main/VERSION").ConfigureAwait(false); + + if (response.IsSuccessStatusCode) + { + var remoteVersion = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + remoteVersion = remoteVersion.Trim(); + + var comparisonResult = string.CompareOrdinal(version, remoteVersion); + + switch (comparisonResult) + { + case < 0: + logger.LogWarning("Plugin is outdated! Check https://github.com/daffyyyy/CS2-SimpleAdmin"); + break; + case > 0: + logger.LogInformation("Probably dev version detected"); + break; + default: + logger.LogInformation("Plugin is up to date"); + break; + } + } + else + { + logger.LogWarning("Failed to check version"); + } + } + catch (HttpRequestException ex) + { + logger.LogError(ex, "Failed to connect to the version server."); + } + catch (Exception ex) + { + logger.LogError(ex, "An error occurred while checking version."); + } + } + + internal static void ShowAd(string moduleVersion) + { + Console.WriteLine(" "); + Console.WriteLine(" _______ ___ __ __ _______ ___ _______ _______ ______ __ __ ___ __ _ "); + Console.WriteLine("| || | | |_| || || | | || _ || | | |_| || | | | | |"); + Console.WriteLine("| _____|| | | || _ || | | ___|| |_| || _ || || | | |_| |"); + Console.WriteLine("| |_____ | | | || |_| || | | |___ | || | | || || | | |"); + Console.WriteLine("|_____ || | | || ___|| |___ | ___|| || |_| || || | | _ |"); + Console.WriteLine(" _____| || | | ||_|| || | | || |___ | _ || || ||_|| || | | | | |"); + Console.WriteLine("|_______||___| |_| |_||___| |_______||_______||__| |__||______| |_| |_||___| |_| |__|"); + Console.WriteLine(" >> Version: " + moduleVersion); + Console.WriteLine(" >> GitHub: https://github.com/daffyyyy/CS2-SimpleAdmin"); + Console.WriteLine(" "); + } + } + public class SchemaString(TSchemaClass instance, string member) : NativeObject(Schema.GetSchemaValue(instance.Handle, typeof(TSchemaClass).Name, member)) where TSchemaClass : NativeObject diff --git a/Managers/AdminSQLManager.cs b/Managers/AdminSQLManager.cs index 15552c0..c824987 100644 --- a/Managers/AdminSQLManager.cs +++ b/Managers/AdminSQLManager.cs @@ -7,7 +7,7 @@ using System.Collections.Concurrent; namespace CS2_SimpleAdmin; -public class AdminSQLManager(Database database) +public class AdminSQLManager(Database.Database database) { // Unused for now //public static readonly ConcurrentDictionary> _adminCache = new ConcurrentDictionary>(); diff --git a/Managers/BanManager.cs b/Managers/BanManager.cs index a35926f..599e029 100644 --- a/Managers/BanManager.cs +++ b/Managers/BanManager.cs @@ -5,7 +5,7 @@ using MySqlConnector; namespace CS2_SimpleAdmin; -internal class BanManager(Database database, CS2_SimpleAdminConfig config) +internal class BanManager(Database.Database database, CS2_SimpleAdminConfig config) { public async Task BanPlayer(PlayerInfo player, PlayerInfo issuer, string reason, int time = 0) { diff --git a/Managers/MuteManager.cs b/Managers/MuteManager.cs index 060e39f..6adb554 100644 --- a/Managers/MuteManager.cs +++ b/Managers/MuteManager.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.Logging; namespace CS2_SimpleAdmin; -internal class MuteManager(Database database) +internal class MuteManager(Database.Database database) { public async Task MutePlayer(PlayerInfo player, PlayerInfo issuer, string reason, int time = 0, int type = 0) { diff --git a/Menus/ManageServerMenu.cs b/Menus/ManageServerMenu.cs index 35817ee..3fd6321 100644 --- a/Menus/ManageServerMenu.cs +++ b/Menus/ManageServerMenu.cs @@ -14,8 +14,8 @@ namespace CS2_SimpleAdmin.Menus if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false) { admin.PrintToChat(localizer?["sa_prefix"] ?? - "[SimpleAdmin] " + - (localizer?["sa_no_permission"] ?? "You do not have permissions to use this command") + "[SimpleAdmin] " + + (localizer?["sa_no_permission"] ?? "You do not have permissions to use this command") ); return; } diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..7872007 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.4.3a \ No newline at end of file diff --git a/lang/ar.json b/lang/ar.json index af24c35..481e961 100644 --- a/lang/ar.json +++ b/lang/ar.json @@ -4,6 +4,8 @@ "sa_unknown": "مجهول", "sa_no_permission": "ليس لديك الصلاحيات لاستخدام هذا الأمر.", + "sa_ban_max_duration_exceeded": "مدة الحظر لا يمكن أن تتجاوز {lightred}{0}{default} دقيقة.", + "sa_ban_perm_restricted": "ليس لديك الحق في الحظر الدائم.", "sa_admin_add": "إضافة مسؤول", "sa_admin_remove": "إزالة المسؤول", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(لاعب) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** أصدر الأمر `{1}` على الخادم `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index b63bf2d..9524a43 100644 --- a/lang/en.json +++ b/lang/en.json @@ -4,6 +4,8 @@ "sa_unknown": "Unknown", "sa_no_permission": "You do not have permissions to use this command.", + "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", + "sa_ban_perm_restricted": "You do not have the right to permanently ban.", "sa_admin_add": "Add Admin", "sa_admin_remove": "Remove Admin", @@ -100,7 +102,4 @@ "sa_adminchat_template_admin": "{LIME}(ADMIN) {lightred}{0}{default}: {lightred}{1}{default}", "sa_adminchat_template_player": "{SILVER}(PLAYER) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** issued command `{1}` on server `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/es.json b/lang/es.json index a717a7e..044c1e0 100644 --- a/lang/es.json +++ b/lang/es.json @@ -4,6 +4,8 @@ "sa_unknown": "Desconocido", "sa_no_permission": "No tienes permisos para usar este comando.", + "sa_ban_max_duration_exceeded": "La duración de la prohibición no puede exceder {lightred}{0}{default} minutos.", + "sa_ban_perm_restricted": "No tienes derecho a prohibir permanentemente.", "sa_admin_add": "Agregar Administrador", "sa_admin_remove": "Eliminar Administrador", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(JUGADOR) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** emitió el comando `{1}` en el servidor `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/fa.json b/lang/fa.json index b921ab4..228fa53 100644 --- a/lang/fa.json +++ b/lang/fa.json @@ -4,6 +4,8 @@ "sa_unknown": "ناشناخته", "sa_no_permission": "شما دسترسی برای استفاده از این دستور را ندارید.", + "sa_ban_max_duration_exceeded": "مدت ممنوعیت نمی‌تواند بیشتر از {lightred}{0}{default} دقیقه باشد.", + "sa_ban_perm_restricted": "شما اجازه ممنوعیت دائم را ندارید.", "sa_admin_add": "افزودن مدیر", "sa_admin_remove": "حذف مدیر", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(بازیکن) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** دستور `{1}` را در سرور `HOSTNAME` اجرا کرد", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index de3ac45..f1af48f 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -4,6 +4,8 @@ "sa_unknown": "Inconnu", "sa_no_permission": "Vous n'avez pas les permissions pour utiliser cette commande.", + "sa_ban_max_duration_exceeded": "La durée d'interdiction ne peut pas dépasser {lightred}{0}{default} minutes.", + "sa_ban_perm_restricted": "Vous n'avez pas le droit de bannir définitivement.", "sa_admin_add": "Ajouter un administrateur", "sa_admin_remove": "Supprimer un administrateur", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(JOUEUR) {lightred}{0}{default} : {lightred}{1}{default}", "sa_discord_log_command": "**{0}** a exécuté la commande `{1}` sur le serveur `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "La durée d'un bannissement ne peut dépasser {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "Tu ne peux pas bannir de manière permanente" } \ No newline at end of file diff --git a/lang/lv.json b/lang/lv.json index a7e8de1..1adaea5 100644 --- a/lang/lv.json +++ b/lang/lv.json @@ -4,6 +4,8 @@ "sa_unknown": "Nezināms", "sa_no_permission": "Jums nav atļauju izmantot šo komandu.", + "sa_ban_max_duration_exceeded": "Aizlieguma ilgums nevar pārsniegt {lightred}{0}{default} minūtes.", + "sa_ban_perm_restricted": "Jums nav tiesību uz pastāvīgu aizliegumu.", "sa_admin_add": "Pievienot administratoru", "sa_admin_remove": "Noņemt administratoru", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(SPĒLĒTĀJS) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** izmantoja komandu `{1}` uz servera `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/pl.json b/lang/pl.json index 66f8155..f50881c 100644 --- a/lang/pl.json +++ b/lang/pl.json @@ -4,6 +4,8 @@ "sa_unknown": "Brak", "sa_no_permission": "Nie masz uprawnień do korzystania z tej komendy.", + "sa_ban_max_duration_exceeded": "Czas bana nie może przekraczać {lightred}{0}{default} minut.", + "sa_ban_perm_restricted": "Nie masz prawa do trwałego zbanowania.", "sa_admin_add": "Dodaj administratora", "sa_admin_remove": "Usuń administratora", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(GRACZ) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** użył komendy `{1}` na serwerze `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/pt-BR.json b/lang/pt-BR.json index 0684673..6adf0c9 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -4,6 +4,8 @@ "sa_unknown": "Desconhecido", "sa_no_permission": "Você não tem permissão para usar este comando.", + "sa_ban_max_duration_exceeded": "A duração da proibição não pode exceder {lightred}{0}{default} minutos.", + "sa_ban_perm_restricted": "Você não tem permissão para banir permanentemente.", "sa_admin_add": "Adicionar Admin", "sa_admin_remove": "Remover Admin", @@ -101,7 +103,4 @@ "sa_adminchat_template_player": "{SILVER}(JOGADOR) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** emitiu o comando `{1}` no servidor `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/ru.json b/lang/ru.json index e7fa2ec..2d69ee8 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -4,6 +4,8 @@ "sa_unknown": "Неизвестный", "sa_no_permission": "У вас нет прав для использования этой команды.", + "sa_ban_max_duration_exceeded": "Продолжительность бана не может превышать {lightred}{0}{default} минут.", + "sa_ban_perm_restricted": "У вас нет прав на постоянный бан.", "sa_admin_add": "Добавить администратора", "sa_admin_remove": "Удалить администратора", @@ -100,7 +102,4 @@ "sa_adminchat_template_player": "{SILVER}(ИГРОК) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** выполнил команду `{1}` на сервере `HOSTNAME`", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/tr.json b/lang/tr.json index 0487007..233bea8 100644 --- a/lang/tr.json +++ b/lang/tr.json @@ -4,6 +4,8 @@ "sa_unknown": "Bilinmeyen", "sa_no_permission": "Bu komutu kullanma izniniz yok.", + "sa_ban_max_duration_exceeded": "Yasaklama süresi {lightred}{0}{default} dakikadan fazla olamaz.", + "sa_ban_perm_restricted": "Kalıcı yasaklama hakkınız yok.", "sa_admin_add": "Yönetici Ekle", "sa_admin_remove": "Yönetici Kaldır", @@ -100,7 +102,4 @@ "sa_adminchat_template_player": "{SILVER}(OYUNCU) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}**, sunucuda `HOSTNAME` üzerinde `{1}` komutunu gerçekleştirdi!", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file diff --git a/lang/zh-Hans.json b/lang/zh-Hans.json index 40f00b4..ae91229 100644 --- a/lang/zh-Hans.json +++ b/lang/zh-Hans.json @@ -4,6 +4,8 @@ "sa_unknown": "未知", "sa_no_permission": "您没有权限使用此命令。", + "sa_ban_max_duration_exceeded": "禁令持续时间不能超过{lightred}{0}{default}分钟。", + "sa_ban_perm_restricted": "您没有永久封禁的权限。", "sa_admin_add": "添加管理员", "sa_admin_remove": "移除管理员", @@ -100,7 +102,4 @@ "sa_adminchat_template_player": "{SILVER}(玩家) {lightred}{0}{default}: {lightred}{1}{default}", "sa_discord_log_command": "**{0}** 在服务器 `HOSTNAME` 上执行了命令 `{1}`!", - - "sa_ban_max_duration_exceeded": "Ban duration cannot exceed {lightred}{0}{default} minutes.", - "sa_ban_perm_restricted": "You do not have the right to permanently ban." } \ No newline at end of file