- New feature permban permission (@css/permban)
- CustomCommand fix
- Version checker
- Minor changes
- Updated to CounterStrikeSharp 225
- Bump version to 1.4.3a
This commit is contained in:
Dawid Bepierszcz
2024-04-30 14:05:20 +02:00
parent 342d4f717f
commit 19f8b68c1c
30 changed files with 308 additions and 255 deletions

View File

@@ -17,27 +17,28 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public static CS2_SimpleAdmin Instance { get; private set; } = new(); public static CS2_SimpleAdmin Instance { get; private set; } = new();
public static IStringLocalizer? _localizer; public static IStringLocalizer? _localizer;
public static Dictionary<string, int> voteAnswers = []; public static readonly Dictionary<string, int> VoteAnswers = [];
private static ConcurrentBag<int> godPlayers = []; private static readonly ConcurrentBag<int> GodPlayers = [];
private static ConcurrentBag<int> silentPlayers = []; private static readonly ConcurrentBag<int> SilentPlayers = [];
private static ConcurrentBag<string> bannedPlayers = []; private static readonly ConcurrentBag<string> BannedPlayers = [];
private static bool TagsDetected; private static bool _tagsDetected;
public static bool voteInProgress = false; private static bool _adminsLoaded;
public static bool VoteInProgress = false;
public static int? ServerId = null; public static int? ServerId = null;
public static DiscordWebhookClient? _discordWebhookClientLog; public static DiscordWebhookClient? DiscordWebhookClientLog;
public static DiscordWebhookClient? _discordWebhookClientPenalty; public static DiscordWebhookClient? DiscordWebhookClientPenalty;
internal string dbConnectionString = string.Empty; private string _dbConnectionString = string.Empty;
internal static Database? _database; private static Database.Database? _database;
internal static ILogger? _logger; internal static ILogger? _logger;
public static MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? CBasePlayerControllerSetPawnFunc; private static MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? _cBasePlayerControllerSetPawnFunc;
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)"); public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)"; public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy & Dliix66"; 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(); public CS2_SimpleAdminConfig Config { get; set; } = new();
@@ -52,19 +53,21 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
OnMapStart(string.Empty); OnMapStart(string.Empty);
} }
CBasePlayerControllerSetPawnFunc = new MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>(GameData.GetSignature("CBasePlayerController_SetPawn")); _cBasePlayerControllerSetPawnFunc = new MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>(GameData.GetSignature("CBasePlayerController_SetPawn"));
} }
public void OnConfigParsed(CS2_SimpleAdminConfig config) public void OnConfigParsed(CS2_SimpleAdminConfig config)
{ {
if (config.DatabaseHost.Length < 1 || config.DatabaseName.Length < 1 || config.DatabaseUser.Length < 1) 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!"); throw new Exception("[CS2-SimpleAdmin] You need to setup Database credentials in config!");
} }
Instance = this; Instance = this;
_logger = Logger; _logger = Logger;
MySqlConnectionStringBuilder builder = new() MySqlConnectionStringBuilder builder = new()
{ {
Server = config.DatabaseHost, Server = config.DatabaseHost,
@@ -77,8 +80,8 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
MaximumPoolSize = 640, MaximumPoolSize = 640,
}; };
dbConnectionString = builder.ConnectionString; _dbConnectionString = builder.ConnectionString;
_database = new(dbConnectionString); _database = new Database.Database(_dbConnectionString);
if (!_database.CheckDatabaseConnection()) if (!_database.CheckDatabaseConnection())
{ {
@@ -132,9 +135,12 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
_localizer = Localizer; _localizer = Localizer;
if (!string.IsNullOrEmpty(Config.Discord.DiscordLogWebhook)) if (!string.IsNullOrEmpty(Config.Discord.DiscordLogWebhook))
_discordWebhookClientLog = new DiscordWebhookClient(Config.Discord.DiscordLogWebhook); DiscordWebhookClientLog = new DiscordWebhookClient(Config.Discord.DiscordLogWebhook);
if (!string.IsNullOrEmpty(Config.Discord.DiscordPenaltyWebhook)) if (!string.IsNullOrEmpty(Config.Discord.DiscordPenaltyWebhook))
_discordWebhookClientPenalty = new DiscordWebhookClient(Config.Discord.DiscordPenaltyWebhook); DiscordWebhookClientPenalty = new DiscordWebhookClient(Config.Discord.DiscordPenaltyWebhook);
PluginInfo.ShowAd(ModuleVersion);
_ = PluginInfo.CheckVersion(ModuleVersion, _logger);
} }
private static TargetResult? GetTarget(CommandInfo command) private static TargetResult? GetTarget(CommandInfo command)
@@ -157,7 +163,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
return null; return null;
} }
public static void RemoveFromConcurrentBag(ConcurrentBag<int> bag, int playerSlot) private static void RemoveFromConcurrentBag(ConcurrentBag<int> bag, int playerSlot)
{ {
List<int> tempList = []; List<int> tempList = [];
while (!bag.IsEmpty) while (!bag.IsEmpty)

View File

@@ -10,7 +10,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.220" /> <PackageReference Include="CounterStrikeSharp.API" Version="1.0.225" />
<PackageReference Include="Dapper" Version="2.1.35" /> <PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Discord.Net.Webhook" Version="3.14.1" /> <PackageReference Include="Discord.Net.Webhook" Version="3.14.1" />
<PackageReference Include="MySqlConnector" Version="2.3.7" /> <PackageReference Include="MySqlConnector" Version="2.3.7" />

View File

@@ -29,7 +29,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Database database = new(dbConnectionString); Database.Database database = new(_dbConnectionString);
BanManager banManager = new(database, Config); BanManager banManager = new(database, Config);
int.TryParse(command.GetArg(2), out var time); int.TryParse(command.GetArg(2), out var time);
@@ -84,10 +84,10 @@ namespace CS2_SimpleAdmin
AddTimer(Config.KickTime, () => Helper.KickPlayer(player.UserId.Value), AddTimer(Config.KickTime, () => Helper.KickPlayer(player.UserId.Value),
CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
if (playerInfo.IpAddress != null && !bannedPlayers.Contains(playerInfo.IpAddress)) if (playerInfo.IpAddress != null && !BannedPlayers.Contains(playerInfo.IpAddress))
bannedPlayers.Add(playerInfo.IpAddress); BannedPlayers.Add(playerInfo.IpAddress);
if (!bannedPlayers.Contains(player.SteamID.ToString())) if (!BannedPlayers.Contains(player.SteamID.ToString()))
bannedPlayers.Add(player.SteamID.ToString()); BannedPlayers.Add(player.SteamID.ToString());
if (time == 0) if (time == 0)
{ {
@@ -97,7 +97,7 @@ namespace CS2_SimpleAdmin
player.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); 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()) 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]); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -134,9 +134,9 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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")] [ConsoleCommand("css_addban")]
@@ -199,7 +199,7 @@ namespace CS2_SimpleAdmin
{ {
player.PrintToCenter(_localizer!["sa_player_ban_message_perm", reason, caller == null ? "Console" : caller.PlayerName]); 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()) 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]); 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()) 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 () => Task.Run(async () =>
@@ -245,7 +245,7 @@ namespace CS2_SimpleAdmin
}); });
Helper.LogCommand(caller, command); 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);
command.ReplyToCommand($"Banned player with steamid {steamid}."); command.ReplyToCommand($"Banned player with steamid {steamid}.");
@@ -271,7 +271,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
var reason = _localizer?["sa_unknown"] ?? "Unknown"; 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]); 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()) 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]); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -353,7 +353,7 @@ namespace CS2_SimpleAdmin
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, 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 () => Task.Run(async () =>
@@ -363,32 +363,28 @@ namespace CS2_SimpleAdmin
}); });
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
command.ReplyToCommand($"Banned player with IP address {ipAddress}."); command.ReplyToCommand($"Banned player with IP address {ipAddress}.");
} }
private bool CheckValidBan(CCSPlayerController? caller, int duration) 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 (duration > Config.MaxBanDuration && canPermBan == false)
{ {
if (validCaller) caller.PrintToChat($"{_localizer!["sa_prefix"]} {_localizer["sa_ban_max_duration_exceeded", Config.MaxBanDuration]}");
caller.PrintToChat($"{_localizer["sa_prefix"]} {_localizer["sa_ban_max_duration_exceeded", Config.MaxBanDuration]}");
return false;
} }
if (duration == 0 && canPermBan == false) if (duration == 0 && canPermBan == false)
{ {
if (validCaller) caller.PrintToChat($"{_localizer!["sa_prefix"]} {_localizer["sa_ban_perm_restricted"]}");
caller.PrintToChat($"{_localizer!["sa_prefix"]} {_localizer["sa_ban_perm_restricted"]}");
return false;
} }
return true; return caller.IsValid && canPermBan;
} }
[ConsoleCommand("css_unban")] [ConsoleCommand("css_unban")]
@@ -412,7 +408,7 @@ namespace CS2_SimpleAdmin
BanManager banManager = new(_database, Config); BanManager banManager = new(_database, Config);
Task.Run(async () => await banManager.UnbanPlayer(pattern, callerSteamId, reason)); 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); Helper.LogCommand(caller, command);
command.ReplyToCommand($"Unbanned player with pattern {pattern}."); command.ReplyToCommand($"Unbanned player with pattern {pattern}.");

View File

@@ -18,7 +18,7 @@ namespace CS2_SimpleAdmin
{ {
if (caller == null || !caller.IsValid || command.GetCommandString[command.GetCommandString.IndexOf(' ')..].Length == 0) return; 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); Helper.LogCommand(caller, command);
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); 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 utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
var utf8String = Encoding.UTF8.GetString(utf8BytesString); var utf8String = Encoding.UTF8.GetString(utf8BytesString);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
foreach (var player in Helper.GetValidPlayers()) foreach (var player in Helper.GetValidPlayers())
@@ -95,7 +95,7 @@ namespace CS2_SimpleAdmin
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
var utf8String = Encoding.UTF8.GetString(utf8BytesString); var utf8String = Encoding.UTF8.GetString(utf8BytesString);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.PrintToCenterAll(utf8String.ReplaceColorTags()); Helper.PrintToCenterAll(utf8String.ReplaceColorTags());
@@ -109,7 +109,7 @@ namespace CS2_SimpleAdmin
var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]); var utf8BytesString = Encoding.UTF8.GetBytes(command.GetCommandString[command.GetCommandString.IndexOf(' ')..]);
var utf8String = Encoding.UTF8.GetString(utf8BytesString); var utf8String = Encoding.UTF8.GetString(utf8BytesString);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
VirtualFunctions.ClientPrintAll( VirtualFunctions.ClientPrintAll(

View File

@@ -133,7 +133,7 @@ namespace CS2_SimpleAdmin
_ = adminManager.AddAdminBySteamId(steamid, name, flagsList, immunity, time, globalAdmin); _ = adminManager.AddAdminBySteamId(steamid, name, flagsList, immunity, time, globalAdmin);
if (command != null) 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}"); Helper.LogCommand(caller, $"css_addadmin {steamid} {name} {flags} {immunity} {time}");
var msg = $"Added '{flags}' flags to '{name}' ({steamid})"; var msg = $"Added '{flags}' flags to '{name}' ({steamid})";
@@ -184,7 +184,7 @@ namespace CS2_SimpleAdmin
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
if (command != null) if (command != null)
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, $"css_deladmin {steamid}"); Helper.LogCommand(caller, $"css_deladmin {steamid}");
var msg = $"Removed flags from '{steamid}'"; var msg = $"Removed flags from '{steamid}'";
@@ -231,7 +231,7 @@ namespace CS2_SimpleAdmin
_ = adminManager.AddGroup(name, flagsList, immunity); _ = adminManager.AddGroup(name, flagsList, immunity);
if (command != null) if (command != null)
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, $"css_addgroup {name} {flags} {immunity}"); Helper.LogCommand(caller, $"css_addgroup {name} {flags} {immunity}");
var msg = $"Created group '{name}' with flags '{flags}'"; var msg = $"Created group '{name}' with flags '{flags}'";
@@ -273,7 +273,7 @@ namespace CS2_SimpleAdmin
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
if (command != null) if (command != null)
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, $"css_delgroup {name}"); Helper.LogCommand(caller, $"css_delgroup {name}");
var msg = $"Removed group '{name}'"; var msg = $"Removed group '{name}'";
@@ -336,15 +336,15 @@ namespace CS2_SimpleAdmin
Helper.LogCommand(caller, command); 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.PrintToChat($"You aren't hidden now!");
caller.ChangeTeam(CsTeam.Spectator); caller.ChangeTeam(CsTeam.Spectator);
} }
else else
{ {
silentPlayers.Add(caller.Slot); SilentPlayers.Add(caller.Slot);
Server.ExecuteCommand("sv_disable_teamselect_menu 1"); Server.ExecuteCommand("sv_disable_teamselect_menu 1");
if (caller.PlayerPawn.Value != null && caller.PawnIsAlive) 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(); 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); BanManager banManager = new(database, Config);
MuteManager muteManager = new(_database); MuteManager muteManager = new(_database);
@@ -498,7 +498,7 @@ namespace CS2_SimpleAdmin
reason ??= _localizer?["sa_unknown"] ?? "Unknown"; reason ??= _localizer?["sa_unknown"] ?? "Unknown";
if (command != null) if (command != null)
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, $"css_kick {player?.PlayerName} {reason}"); Helper.LogCommand(caller, $"css_kick {player?.PlayerName} {reason}");
if (string.IsNullOrEmpty(reason) == false) if (string.IsNullOrEmpty(reason) == false)
@@ -519,7 +519,7 @@ namespace CS2_SimpleAdmin
CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -577,7 +577,7 @@ namespace CS2_SimpleAdmin
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, 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()) foreach (var player in Helper.GetValidPlayers())
{ {
@@ -591,7 +591,7 @@ namespace CS2_SimpleAdmin
} }
if (command == null) return; if (command == null) return;
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); 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}"; 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()) foreach (var player in Helper.GetValidPlayers())
{ {
@@ -631,7 +631,7 @@ namespace CS2_SimpleAdmin
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
if (command == null) return; if (command == null) return;
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
} }
@@ -655,7 +655,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
var value = command.GetArg(2); var value = command.GetArg(2);
@@ -673,7 +673,7 @@ namespace CS2_SimpleAdmin
{ {
var callerName = caller == null ? "Console" : caller.PlayerName; var callerName = caller == null ? "Console" : caller.PlayerName;
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Server.ExecuteCommand(command.ArgString); Server.ExecuteCommand(command.ArgString);

View File

@@ -71,7 +71,7 @@ namespace CS2_SimpleAdmin
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time); await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
}); });
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
PlayerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); 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()) 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -123,8 +123,8 @@ namespace CS2_SimpleAdmin
} }
if (command == null) return; if (command == null) return;
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer); Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, DiscordWebhookClientPenalty, _localizer);
Helper.LogCommand(caller, command); 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]); 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()) 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]); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -220,13 +220,13 @@ namespace CS2_SimpleAdmin
} }
} }
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_mute {player.SteamID}"); Server.ExecuteCommand($"css_tag_mute {player.SteamID}");
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time); 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 () => Task.Run(async () =>
@@ -234,7 +234,7 @@ namespace CS2_SimpleAdmin
await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time); await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time);
}); });
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
command.ReplyToCommand($"Gagged player with steamid {steamid}."); command.ReplyToCommand($"Gagged player with steamid {steamid}.");
@@ -258,7 +258,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
var found = false; var found = false;
@@ -276,7 +276,7 @@ namespace CS2_SimpleAdmin
{ {
PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Gag); PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Gag);
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); Server.ExecuteCommand($"css_tag_unmute {player.SteamID}");
found = true; found = true;
@@ -295,7 +295,7 @@ namespace CS2_SimpleAdmin
{ {
PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Gag); PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Gag);
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_unmute {player.SteamID.ToString()}"); Server.ExecuteCommand($"css_tag_unmute {player.SteamID.ToString()}");
pattern = 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]); 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()) 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]); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -458,8 +458,8 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer);
Helper.LogCommand(caller, command); 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]); 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()) 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]); 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()) 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 () => Task.Run(async () =>
@@ -564,7 +564,7 @@ namespace CS2_SimpleAdmin
await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1); await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1);
}); });
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
command.ReplyToCommand($"Muted player with steamid {steamid}."); command.ReplyToCommand($"Muted player with steamid {steamid}.");
@@ -588,7 +588,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
var pattern = command.GetArg(1); var pattern = command.GetArg(1);
@@ -727,7 +727,7 @@ namespace CS2_SimpleAdmin
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2); await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2);
}); });
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}"); Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
player!.VoiceFlags = VoiceFlags.Muted; 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()) 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -782,8 +782,8 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer); Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, DiscordWebhookClientPenalty, _localizer);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
} }
} }
@@ -836,7 +836,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_mute {player.SteamID}"); Server.ExecuteCommand($"css_tag_mute {player.SteamID}");
PlayerPenaltyManager.AddPenalty(player.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time); 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]); 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()) 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]); 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()) 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 () => Task.Run(async () =>
@@ -890,7 +890,7 @@ namespace CS2_SimpleAdmin
await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2); await muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2);
}); });
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
command.ReplyToCommand($"Silenced player with steamid {steamid}."); command.ReplyToCommand($"Silenced player with steamid {steamid}.");
@@ -914,7 +914,7 @@ namespace CS2_SimpleAdmin
return; return;
} }
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
var pattern = command.GetArg(1); var pattern = command.GetArg(1);
@@ -929,7 +929,7 @@ namespace CS2_SimpleAdmin
var player = matches.FirstOrDefault(); var player = matches.FirstOrDefault();
if (player != null && player.IsValid) if (player != null && player.IsValid)
{ {
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); Server.ExecuteCommand($"css_tag_unmute {player.SteamID}");
PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Silence); PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Silence);
@@ -948,7 +948,7 @@ namespace CS2_SimpleAdmin
var player = matches.FirstOrDefault(); var player = matches.FirstOrDefault();
if (player != null && player.IsValid) if (player != null && player.IsValid)
{ {
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); Server.ExecuteCommand($"css_tag_unmute {player.SteamID}");
PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Silence); PlayerPenaltyManager.RemovePenaltiesByType(player.Slot, PenaltyType.Silence);

View File

@@ -18,19 +18,19 @@ namespace CS2_SimpleAdmin
if (command.ArgCount < 2) if (command.ArgCount < 2)
return; return;
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
voteAnswers.Clear(); VoteAnswers.Clear();
var question = command.GetArg(1); var question = command.GetArg(1);
var answersCount = command.ArgCount; 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++) 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()) foreach (var player in Helper.GetValidPlayers())
@@ -55,10 +55,10 @@ namespace CS2_SimpleAdmin
} }
} }
voteInProgress = true; VoteInProgress = true;
} }
if (voteInProgress) if (VoteInProgress)
{ {
AddTimer(30, () => 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()) foreach (var player in Helper.GetValidPlayers())
{ {
@@ -84,8 +84,8 @@ namespace CS2_SimpleAdmin
} }
} }
} }
voteAnswers.Clear(); VoteAnswers.Clear();
voteInProgress = false; VoteInProgress = false;
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
} }
} }

View File

@@ -21,7 +21,7 @@ namespace CS2_SimpleAdmin
player.IsValid && player.SteamID.ToString().Length == 17 && player.IsValid && player.SteamID.ToString().Length == 17 &&
player is { PawnIsAlive: true, IsHLTV: false }).ToList(); player is { PawnIsAlive: true, IsHLTV: false }).ToList();
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
@@ -39,7 +39,7 @@ namespace CS2_SimpleAdmin
Helper.LogCommand(caller, $"css_noclip {player.PlayerName}"); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -62,7 +62,7 @@ namespace CS2_SimpleAdmin
var targets = GetTarget(command); var targets = GetTarget(command);
var playersToTarget = targets!.Players.Where(player => player is { IsValid: true, PawnIsAlive: true, IsHLTV: false }).ToList(); 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 => playersToTarget.ForEach(player =>
{ {
@@ -87,7 +87,7 @@ namespace CS2_SimpleAdmin
if (time > 0) if (time > 0)
AddTimer(time, () => player?.Pawn.Value!.Unfreeze(), CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -127,10 +127,10 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))

View File

@@ -40,11 +40,11 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -114,7 +114,7 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
} }
player.GiveNamedItem(weaponName); player.GiveNamedItem(weaponName);
@@ -125,7 +125,7 @@ namespace CS2_SimpleAdmin
{ {
callerName ??= caller == null ? "Console" : caller.PlayerName; 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -169,10 +169,10 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -217,10 +217,10 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -266,10 +266,10 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -292,7 +292,7 @@ namespace CS2_SimpleAdmin
var targets = GetTarget(command); var targets = GetTarget(command);
if (targets == null) return; 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(); 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) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -366,10 +366,10 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -412,19 +412,19 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))
@@ -473,10 +473,10 @@ namespace CS2_SimpleAdmin
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -582,7 +582,7 @@ namespace CS2_SimpleAdmin
if (command == null) return; if (command == null) return;
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
} }
[ConsoleCommand("css_rename", "Rename a player.")] [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(); var playersToTarget = targets!.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
@@ -608,7 +608,7 @@ namespace CS2_SimpleAdmin
return; return;
if (!caller!.CanTarget(player)) 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
@@ -651,20 +651,20 @@ namespace CS2_SimpleAdmin
{ {
callerName ??= caller == null ? "Console" : caller.PlayerName; 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; var playerPawn = player.PlayerPawn.Value;
CBasePlayerControllerSetPawnFunc.Invoke(player, playerPawn, true, false); _cBasePlayerControllerSetPawnFunc.Invoke(player, playerPawn, true, false);
VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle, VirtualFunction.CreateVoid<CCSPlayerController>(player.Handle,
GameData.GetOffset("CCSPlayerController_Respawn"))(player); GameData.GetOffset("CCSPlayerController_Respawn"))(player);
if (command != null) if (command != null)
{ {
Helper.LogCommand(caller, command); 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()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) 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(); var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
@@ -709,7 +709,7 @@ namespace CS2_SimpleAdmin
caller.Pawn.Value!.ToggleNoclip(); caller.Pawn.Value!.ToggleNoclip();
}); });
if (silentPlayers.Contains(caller.Slot)) return; if (SilentPlayers.Contains(caller.Slot)) return;
foreach (var controller in Helper.GetValidPlayers()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) 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(); var playersToTarget = targets.Players.Where(player => player is { IsValid: true, IsHLTV: false }).ToList();
Helper.LogCommand(caller, command); Helper.LogCommand(caller, command);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer); Helper.SendDiscordLogMessage(caller, command, DiscordWebhookClientLog, _localizer);
playersToTarget.ForEach(player => playersToTarget.ForEach(player =>
{ {
@@ -754,7 +754,7 @@ namespace CS2_SimpleAdmin
caller.Pawn.Value!.ToggleNoclip(); caller.Pawn.Value!.ToggleNoclip();
}); });
if (silentPlayers.Contains(caller.Slot)) return; if (SilentPlayers.Contains(caller.Slot)) return;
foreach (var controller in Helper.GetValidPlayers()) foreach (var controller in Helper.GetValidPlayers())
{ {
using (new WithTemporaryCulture(controller.GetLanguage())) using (new WithTemporaryCulture(controller.GetLanguage()))

View File

@@ -11,7 +11,7 @@ namespace CS2_SimpleAdmin
[JsonPropertyName("duration")] [JsonPropertyName("duration")]
public int Duration { get; set; } public int Duration { get; set; }
} }
public class AdminFlag public class AdminFlag
{ {
[JsonPropertyName("name")] [JsonPropertyName("name")]
@@ -60,7 +60,7 @@ namespace CS2_SimpleAdmin
new DurationItem { Name = "30 days", Duration = 60 * 24 * 30 }, new DurationItem { Name = "30 days", Duration = 60 * 24 * 30 },
new DurationItem { Name = "Permanent", Duration = 0 } new DurationItem { Name = "Permanent", Duration = 0 }
]; ];
[JsonPropertyName("BanReasons")] [JsonPropertyName("BanReasons")]
public List<string> BanReasons { get; set; } = public List<string> BanReasons { get; set; } =
[ [
@@ -70,16 +70,16 @@ namespace CS2_SimpleAdmin
"Admin disrespect", "Admin disrespect",
"Other" "Other"
]; ];
[JsonPropertyName("KickReasons")] [JsonPropertyName("KickReasons")]
public List<string> KickReasons { get; set; } = public List<string> KickReasons { get; set; } =
[ [
"Voice Abuse", "Voice Abuse",
"Chat Abuse", "Chat Abuse",
"Admin disrespect", "Admin disrespect",
"Other" "Other"
]; ];
[JsonPropertyName("MuteReasons")] [JsonPropertyName("MuteReasons")]
public List<string> MuteReasons { get; set; } = public List<string> MuteReasons { get; set; } =
[ [
@@ -90,7 +90,7 @@ namespace CS2_SimpleAdmin
"Admin disrespect", "Admin disrespect",
"Other" "Other"
]; ];
[JsonPropertyName("AdminFlags")] [JsonPropertyName("AdminFlags")]
public AdminFlag[] AdminFlags { get; set; } = public AdminFlag[] AdminFlags { get; set; } =
[ [
@@ -109,7 +109,7 @@ namespace CS2_SimpleAdmin
public class CS2_SimpleAdminConfig : BasePluginConfig 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")] [JsonPropertyName("DatabaseHost")]
public string DatabaseHost { get; set; } = ""; public string DatabaseHost { get; set; } = "";
@@ -137,33 +137,33 @@ namespace CS2_SimpleAdmin
[JsonPropertyName("DisableDangerousCommands")] [JsonPropertyName("DisableDangerousCommands")]
public bool DisableDangerousCommands { get; set; } = true; public bool DisableDangerousCommands { get; set; } = true;
[JsonPropertyName("MaxBanDuration")]
public int MaxBanDuration { get; set; } = 60 * 24; // 1 day
[JsonPropertyName("BanType")] [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")] [JsonPropertyName("MultiServerMode")]
public bool MultiServerMode { get; } = true; public bool MultiServerMode { get; set; } = true;
[JsonPropertyName("ExpireOldIpBans")] [JsonPropertyName("ExpireOldIpBans")]
public int ExpireOldIpBans { get; } = 0; public int ExpireOldIpBans { get; set; } = 0;
[JsonPropertyName("TeamSwitchType")] [JsonPropertyName("TeamSwitchType")]
public int TeamSwitchType { get; } = 1; public int TeamSwitchType { get; set; } = 1;
[JsonPropertyName("Discord")] [JsonPropertyName("Discord")]
public Discord Discord { get; } = new(); public Discord Discord { get; set; } = new();
[JsonPropertyName("DefaultMaps")] [JsonPropertyName("DefaultMaps")]
public List<string> DefaultMaps { get; } = []; public List<string> DefaultMaps { get; set; } = [];
[JsonPropertyName("WorkshopMaps")] [JsonPropertyName("WorkshopMaps")]
public List<string> WorkshopMaps { get; } = []; public List<string> WorkshopMaps { get; set; } = [];
[JsonPropertyName("CustomServerCommands")] [JsonPropertyName("CustomServerCommands")]
public List<CustomServerCommandData> CustomServerCommands { get; set; } = []; public List<CustomServerCommandData> CustomServerCommands { get; set; } = new();
[JsonPropertyName("MenuConfig")] [JsonPropertyName("MenuConfig")]
public MenuConfig MenuConfigs { get; set; } = new(); public MenuConfig MenuConfigs { get; set; } = new();
} }

View File

@@ -1,17 +1,15 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MySqlConnector; using MySqlConnector;
namespace CS2_SimpleAdmin; namespace CS2_SimpleAdmin.Database;
public class Database(string dbConnectionString) public class Database(string dbConnectionString)
{ {
private readonly string _dbConnectionString = dbConnectionString;
public MySqlConnection GetConnection() public MySqlConnection GetConnection()
{ {
try try
{ {
var connection = new MySqlConnection(_dbConnectionString); var connection = new MySqlConnection(dbConnectionString);
connection.Open(); connection.Open();
return connection; return connection;
} }
@@ -27,7 +25,7 @@ public class Database(string dbConnectionString)
{ {
try try
{ {
var connection = new MySqlConnection(_dbConnectionString); var connection = new MySqlConnection(dbConnectionString);
await connection.OpenAsync(); await connection.OpenAsync();
return connection; return connection;
} }

View File

@@ -1,12 +1,10 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MySqlConnector; using MySqlConnector;
namespace CS2_SimpleAdmin; namespace CS2_SimpleAdmin.Database;
public class Migration(Database database) public class Migration(Database database)
{ {
private readonly Database _database = database;
public void ExecuteMigrations() public void ExecuteMigrations()
{ {
var migrationsDirectory = CS2_SimpleAdmin.Instance.ModuleDirectory + "/Database/Migrations"; var migrationsDirectory = CS2_SimpleAdmin.Instance.ModuleDirectory + "/Database/Migrations";
@@ -14,11 +12,10 @@ public class Migration(Database database)
var files = Directory.GetFiles(migrationsDirectory, "*.sql") var files = Directory.GetFiles(migrationsDirectory, "*.sql")
.OrderBy(f => f); .OrderBy(f => f);
using var connection = _database.GetConnection(); using var connection = database.GetConnection();
// Create sa_migrations table if not exists // Create sa_migrations table if not exists
using var cmd = new MySqlCommand(""" using var cmd = new MySqlCommand("""
CREATE TABLE IF NOT EXISTS `sa_migrations` ( CREATE TABLE IF NOT EXISTS `sa_migrations` (
`id` INT PRIMARY KEY AUTO_INCREMENT, `id` INT PRIMARY KEY AUTO_INCREMENT,
`version` VARCHAR(255) NOT NULL `version` VARCHAR(255) NOT NULL

View File

@@ -50,19 +50,19 @@ public partial class CS2_SimpleAdmin
{ {
PlayerPenaltyManager.RemoveAllPenalties(player.Slot); PlayerPenaltyManager.RemoveAllPenalties(player.Slot);
if (TagsDetected) if (_tagsDetected)
{ {
Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); 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; SteamID? authorizedSteamId = player.AuthorizedSteamID;
@@ -96,7 +96,7 @@ public partial class CS2_SimpleAdmin
var ipAddress = player.IpAddress.Split(":")[0]; var ipAddress = player.IpAddress.Split(":")[0];
// Check if the player's IP or SteamID is in the bannedPlayers list // 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 // Kick the player if banned
if (player.UserId.HasValue) if (player.UserId.HasValue)
@@ -130,17 +130,17 @@ public partial class CS2_SimpleAdmin
if (isBanned) if (isBanned)
{ {
// Add player's IP and SteamID to bannedPlayers list if not already present // Add player's IP and SteamID to bannedPlayers list if not already present
if (playerInfo.IpAddress != null && !bannedPlayers.Contains(playerInfo.IpAddress)) if (playerInfo.IpAddress != null && !BannedPlayers.Contains(playerInfo.IpAddress))
bannedPlayers.Add(playerInfo.IpAddress); BannedPlayers.Add(playerInfo.IpAddress);
if (playerInfo.SteamId != null && !bannedPlayers.Contains(playerInfo.SteamId)) if (playerInfo.SteamId != null && !BannedPlayers.Contains(playerInfo.SteamId))
bannedPlayers.Add(playerInfo.SteamId); BannedPlayers.Add(playerInfo.SteamId);
// Kick the player if banned // Kick the player if banned
await Server.NextFrameAsync(() => await Server.NextFrameAsync(() =>
{ {
var victim = Utilities.GetPlayerFromUserid(playerInfo.UserId); var victim = Utilities.GetPlayerFromUserid(playerInfo.UserId);
if (victim.UserId.HasValue) if (victim?.UserId != null)
{ {
Helper.KickPlayer(victim.UserId.Value, "Banned"); Helper.KickPlayer(victim.UserId.Value, "Banned");
} }
@@ -166,7 +166,7 @@ public partial class CS2_SimpleAdmin
PlayerPenaltyManager.AddPenalty(playerInfo.Slot, PenaltyType.Gag, ends, duration); PlayerPenaltyManager.AddPenalty(playerInfo.Slot, PenaltyType.Gag, ends, duration);
await Server.NextFrameAsync(() => await Server.NextFrameAsync(() =>
{ {
if (TagsDetected) if (_tagsDetected)
{ {
Server.ExecuteCommand($"css_tag_mute {playerInfo.SteamId}"); Server.ExecuteCommand($"css_tag_mute {playerInfo.SteamId}");
} }
@@ -184,7 +184,7 @@ public partial class CS2_SimpleAdmin
await Server.NextFrameAsync(() => await Server.NextFrameAsync(() =>
{ {
player.VoiceFlags = VoiceFlags.Muted; player.VoiceFlags = VoiceFlags.Muted;
if (TagsDetected) if (_tagsDetected)
{ {
Server.ExecuteCommand($"css_tag_mute {playerInfo.SteamId}"); Server.ExecuteCommand($"css_tag_mute {playerInfo.SteamId}");
} }
@@ -213,7 +213,7 @@ public partial class CS2_SimpleAdmin
Logger.LogCritical("[OnRoundEnd]"); Logger.LogCritical("[OnRoundEnd]");
#endif #endif
godPlayers.Clear(); GodPlayers.Clear();
return HookResult.Continue; return HookResult.Continue;
} }
@@ -250,7 +250,7 @@ public partial class CS2_SimpleAdmin
if (AdminManager.PlayerHasPermissions(player, "@css/chat")) 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"))) 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()); p.PrintToChat(sb.ToString());
@@ -258,7 +258,7 @@ public partial class CS2_SimpleAdmin
} }
else 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()); 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"))) 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; return HookResult.Handled;
} }
private void OnMapStart(string mapName) private void OnMapStart(string mapName)
@@ -275,15 +274,16 @@ public partial class CS2_SimpleAdmin
var path = Path.GetDirectoryName(ModuleDirectory); var path = Path.GetDirectoryName(ModuleDirectory);
if (Directory.Exists(path + "/CS2-Tags")) if (Directory.Exists(path + "/CS2-Tags"))
{ {
TagsDetected = true; _tagsDetected = true;
} }
godPlayers.Clear(); _adminsLoaded = false;
silentPlayers.Clear(); GodPlayers.Clear();
SilentPlayers.Clear();
PlayerPenaltyManager.RemoveAllPenalties(); PlayerPenaltyManager.RemoveAllPenalties();
_database = new Database(dbConnectionString); _database = new Database.Database(_dbConnectionString);
AddTimer(61.0f, () => AddTimer(61.0f, () =>
{ {
@@ -313,7 +313,7 @@ public partial class CS2_SimpleAdmin
} }
catch { } catch { }
bannedPlayers.Clear(); BannedPlayers.Clear();
await Server.NextFrameAsync(() => 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 (!PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag) && !PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Silence))
{ {
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); Server.ExecuteCommand($"css_tag_unmute {player.SteamID}");
} }
@@ -335,7 +335,7 @@ public partial class CS2_SimpleAdmin
PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag)) continue; PlayerPenaltyManager.IsPenalized(player.Slot, PenaltyType.Gag)) continue;
player.VoiceFlags = VoiceFlags.Normal; player.VoiceFlags = VoiceFlags.Normal;
if (TagsDetected) if (_tagsDetected)
Server.ExecuteCommand($"css_tag_unmute {player.SteamID}"); Server.ExecuteCommand($"css_tag_unmute {player.SteamID}");
} }
@@ -392,7 +392,7 @@ public partial class CS2_SimpleAdmin
try 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) catch (HttpRequestException ex)
{ {
@@ -402,12 +402,19 @@ public partial class CS2_SimpleAdmin
//await _adminManager.GiveAllGroupsFlags(); //await _adminManager.GiveAllGroupsFlags();
//await _adminManager.GiveAllFlags(); //await _adminManager.GiveAllFlags();
if (_adminsLoaded)
return;
await adminManager.CrateGroupsJsonFile(); await adminManager.CrateGroupsJsonFile();
await adminManager.CreateAdminsJsonFile(); await adminManager.CreateAdminsJsonFile();
AdminManager.LoadAdminData(ModuleDirectory + "/data/admins.json"); await Server.NextFrameAsync(() => {
AdminManager.LoadAdminGroups(ModuleDirectory + "/data/groups.json"); AdminManager.LoadAdminData(ModuleDirectory + "/data/admins.json");
AdminManager.LoadAdminGroups(ModuleDirectory + "/data/groups.json");
});
_adminsLoaded = true;
}); });
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE); }, 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) if (player is null || @event.Attacker is null || !player.PawnIsAlive || player.PlayerPawn.Value == null)
return HookResult.Continue; 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.Health = player.PlayerPawn.Value.MaxHealth;
player.PlayerPawn.Value.ArmorValue = 100; player.PlayerPawn.Value.ArmorValue = 100;

View File

@@ -94,10 +94,8 @@ namespace CS2_SimpleAdmin
} }
if (flags == null) return; 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($"@")) if (flag.StartsWith($"@"))
{ {
//Console.WriteLine($"Adding permission {flag} to SteamID {steamid}"); //Console.WriteLine($"Adding permission {flag} to SteamID {steamid}");
@@ -142,11 +140,11 @@ namespace CS2_SimpleAdmin
internal static void HandleVotes(CCSPlayerController player, ChatMenuOption option) internal static void HandleVotes(CCSPlayerController player, ChatMenuOption option)
{ {
if (!CS2_SimpleAdmin.voteInProgress) if (!CS2_SimpleAdmin.VoteInProgress)
return; return;
option.Disabled = true; option.Disabled = true;
CS2_SimpleAdmin.voteAnswers[option.Text]++; CS2_SimpleAdmin.VoteAnswers[option.Text]++;
} }
internal static void LogCommand(CCSPlayerController? caller, CommandInfo command) internal static void LogCommand(CCSPlayerController? caller, CommandInfo command)
@@ -323,7 +321,7 @@ namespace CS2_SimpleAdmin
public static void TryLogCommandOnDiscord(CCSPlayerController? caller, string commandString) 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; return;
if (caller != null && caller.IsValid == false) if (caller != null && caller.IsValid == false)
@@ -333,12 +331,73 @@ namespace CS2_SimpleAdmin
var communityUrl = caller != null var communityUrl = caller != null
? "<" + new SteamID(caller.SteamID).ToCommunityUrl() + ">" ? "<" + new SteamID(caller.SteamID).ToCommunityUrl() + ">"
: "<https://steamcommunity.com/profiles/0>"; : "<https://steamcommunity.com/profiles/0>";
CS2_SimpleAdmin._discordWebhookClientLog.SendMessageAsync(GenerateMessageDiscord( CS2_SimpleAdmin.DiscordWebhookClientLog.SendMessageAsync(GenerateMessageDiscord(
CS2_SimpleAdmin._localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})", CS2_SimpleAdmin._localizer["sa_discord_log_command", $"[{callerName}]({communityUrl})",
commandString])); 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>(TSchemaClass instance, string member) public class SchemaString<TSchemaClass>(TSchemaClass instance, string member)
: NativeObject(Schema.GetSchemaValue<nint>(instance.Handle, typeof(TSchemaClass).Name, member)) : NativeObject(Schema.GetSchemaValue<nint>(instance.Handle, typeof(TSchemaClass).Name, member))
where TSchemaClass : NativeObject where TSchemaClass : NativeObject

View File

@@ -7,7 +7,7 @@ using System.Collections.Concurrent;
namespace CS2_SimpleAdmin; namespace CS2_SimpleAdmin;
public class AdminSQLManager(Database database) public class AdminSQLManager(Database.Database database)
{ {
// Unused for now // Unused for now
//public static readonly ConcurrentDictionary<string, ConcurrentBag<string>> _adminCache = new ConcurrentDictionary<string, ConcurrentBag<string>>(); //public static readonly ConcurrentDictionary<string, ConcurrentBag<string>> _adminCache = new ConcurrentDictionary<string, ConcurrentBag<string>>();

View File

@@ -5,7 +5,7 @@ using MySqlConnector;
namespace CS2_SimpleAdmin; 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) public async Task BanPlayer(PlayerInfo player, PlayerInfo issuer, string reason, int time = 0)
{ {

View File

@@ -3,7 +3,7 @@ using Microsoft.Extensions.Logging;
namespace CS2_SimpleAdmin; 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) public async Task MutePlayer(PlayerInfo player, PlayerInfo issuer, string reason, int time = 0, int type = 0)
{ {

View File

@@ -14,8 +14,8 @@ namespace CS2_SimpleAdmin.Menus
if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false) if (AdminManager.PlayerHasPermissions(admin, "@css/generic") == false)
{ {
admin.PrintToChat(localizer?["sa_prefix"] ?? admin.PrintToChat(localizer?["sa_prefix"] ??
"[SimpleAdmin] " + "[SimpleAdmin] " +
(localizer?["sa_no_permission"] ?? "You do not have permissions to use this command") (localizer?["sa_no_permission"] ?? "You do not have permissions to use this command")
); );
return; return;
} }

1
VERSION Normal file
View File

@@ -0,0 +1 @@
1.4.3a

View File

@@ -4,6 +4,8 @@
"sa_unknown": "مجهول", "sa_unknown": "مجهول",
"sa_no_permission": "ليس لديك الصلاحيات لاستخدام هذا الأمر.", "sa_no_permission": "ليس لديك الصلاحيات لاستخدام هذا الأمر.",
"sa_ban_max_duration_exceeded": "مدة الحظر لا يمكن أن تتجاوز {lightred}{0}{default} دقيقة.",
"sa_ban_perm_restricted": "ليس لديك الحق في الحظر الدائم.",
"sa_admin_add": "إضافة مسؤول", "sa_admin_add": "إضافة مسؤول",
"sa_admin_remove": "إزالة المسؤول", "sa_admin_remove": "إزالة المسؤول",
@@ -101,7 +103,4 @@
"sa_adminchat_template_player": "{SILVER}(لاعب) {lightred}{0}{default}: {lightred}{1}{default}", "sa_adminchat_template_player": "{SILVER}(لاعب) {lightred}{0}{default}: {lightred}{1}{default}",
"sa_discord_log_command": "**{0}** أصدر الأمر `{1}` على الخادم `HOSTNAME`", "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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Unknown", "sa_unknown": "Unknown",
"sa_no_permission": "You do not have permissions to use this command.", "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_add": "Add Admin",
"sa_admin_remove": "Remove 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_admin": "{LIME}(ADMIN) {lightred}{0}{default}: {lightred}{1}{default}",
"sa_adminchat_template_player": "{SILVER}(PLAYER) {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_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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Desconocido", "sa_unknown": "Desconocido",
"sa_no_permission": "No tienes permisos para usar este comando.", "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_add": "Agregar Administrador",
"sa_admin_remove": "Eliminar Administrador", "sa_admin_remove": "Eliminar Administrador",
@@ -101,7 +103,4 @@
"sa_adminchat_template_player": "{SILVER}(JUGADOR) {lightred}{0}{default}: {lightred}{1}{default}", "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_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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "ناشناخته", "sa_unknown": "ناشناخته",
"sa_no_permission": "شما دسترسی برای استفاده از این دستور را ندارید.", "sa_no_permission": "شما دسترسی برای استفاده از این دستور را ندارید.",
"sa_ban_max_duration_exceeded": "مدت ممنوعیت نمی‌تواند بیشتر از {lightred}{0}{default} دقیقه باشد.",
"sa_ban_perm_restricted": "شما اجازه ممنوعیت دائم را ندارید.",
"sa_admin_add": "افزودن مدیر", "sa_admin_add": "افزودن مدیر",
"sa_admin_remove": "حذف مدیر", "sa_admin_remove": "حذف مدیر",
@@ -101,7 +103,4 @@
"sa_adminchat_template_player": "{SILVER}(بازیکن) {lightred}{0}{default}: {lightred}{1}{default}", "sa_adminchat_template_player": "{SILVER}(بازیکن) {lightred}{0}{default}: {lightred}{1}{default}",
"sa_discord_log_command": "**{0}** دستور `{1}` را در سرور `HOSTNAME` اجرا کرد", "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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Inconnu", "sa_unknown": "Inconnu",
"sa_no_permission": "Vous n'avez pas les permissions pour utiliser cette commande.", "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_add": "Ajouter un administrateur",
"sa_admin_remove": "Supprimer 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_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_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"
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Nezināms", "sa_unknown": "Nezināms",
"sa_no_permission": "Jums nav atļauju izmantot šo komandu.", "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_add": "Pievienot administratoru",
"sa_admin_remove": "Noņemt 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_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_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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Brak", "sa_unknown": "Brak",
"sa_no_permission": "Nie masz uprawnień do korzystania z tej komendy.", "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_add": "Dodaj administratora",
"sa_admin_remove": "Usuń administratora", "sa_admin_remove": "Usuń administratora",
@@ -101,7 +103,4 @@
"sa_adminchat_template_player": "{SILVER}(GRACZ) {lightred}{0}{default}: {lightred}{1}{default}", "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_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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Desconhecido", "sa_unknown": "Desconhecido",
"sa_no_permission": "Você não tem permissão para usar este comando.", "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_add": "Adicionar Admin",
"sa_admin_remove": "Remover Admin", "sa_admin_remove": "Remover Admin",
@@ -101,7 +103,4 @@
"sa_adminchat_template_player": "{SILVER}(JOGADOR) {lightred}{0}{default}: {lightred}{1}{default}", "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_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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Неизвестный", "sa_unknown": "Неизвестный",
"sa_no_permission": "У вас нет прав для использования этой команды.", "sa_no_permission": "У вас нет прав для использования этой команды.",
"sa_ban_max_duration_exceeded": "Продолжительность бана не может превышать {lightred}{0}{default} минут.",
"sa_ban_perm_restricted": "У вас нет прав на постоянный бан.",
"sa_admin_add": "Добавить администратора", "sa_admin_add": "Добавить администратора",
"sa_admin_remove": "Удалить администратора", "sa_admin_remove": "Удалить администратора",
@@ -100,7 +102,4 @@
"sa_adminchat_template_player": "{SILVER}(ИГРОК) {lightred}{0}{default}: {lightred}{1}{default}", "sa_adminchat_template_player": "{SILVER}(ИГРОК) {lightred}{0}{default}: {lightred}{1}{default}",
"sa_discord_log_command": "**{0}** выполнил команду `{1}` на сервере `HOSTNAME`", "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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "Bilinmeyen", "sa_unknown": "Bilinmeyen",
"sa_no_permission": "Bu komutu kullanma izniniz yok.", "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_add": "Yönetici Ekle",
"sa_admin_remove": "Yönetici Kaldır", "sa_admin_remove": "Yönetici Kaldır",
@@ -100,7 +102,4 @@
"sa_adminchat_template_player": "{SILVER}(OYUNCU) {lightred}{0}{default}: {lightred}{1}{default}", "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_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."
} }

View File

@@ -4,6 +4,8 @@
"sa_unknown": "未知", "sa_unknown": "未知",
"sa_no_permission": "您没有权限使用此命令。", "sa_no_permission": "您没有权限使用此命令。",
"sa_ban_max_duration_exceeded": "禁令持续时间不能超过{lightred}{0}{default}分钟。",
"sa_ban_perm_restricted": "您没有永久封禁的权限。",
"sa_admin_add": "添加管理员", "sa_admin_add": "添加管理员",
"sa_admin_remove": "移除管理员", "sa_admin_remove": "移除管理员",
@@ -100,7 +102,4 @@
"sa_adminchat_template_player": "{SILVER}(玩家) {lightred}{0}{default}: {lightred}{1}{default}", "sa_adminchat_template_player": "{SILVER}(玩家) {lightred}{0}{default}: {lightred}{1}{default}",
"sa_discord_log_command": "**{0}** 在服务器 `HOSTNAME` 上执行了命令 `{1}`", "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."
} }