Added translation

- Minor changes
- Version bump
- Added translation
This commit is contained in:
Dawid Bepierszcz
2024-04-02 19:42:16 +02:00
parent 052cea5ce3
commit 89d27e1bd3
21 changed files with 392 additions and 208 deletions

View File

@@ -5,7 +5,6 @@ using CounterStrikeSharp.API.Core.Translations;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Commands.Targeting;
using CounterStrikeSharp.API.Modules.Entities;
using System.Text;
namespace CS2_SimpleAdmin
@@ -21,7 +20,7 @@ namespace CS2_SimpleAdmin
string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
string reason = _localizer?["sa_unknown"] ?? "Unknown";
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -32,10 +31,6 @@ namespace CS2_SimpleAdmin
return;
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int.TryParse(command.GetArg(2), out time);
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
@@ -48,13 +43,12 @@ namespace CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer);
Gag(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command);
}
});
}
internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
internal void Gag(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null)
{
if (_database == null) return;
callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -75,8 +69,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0]
};
Helper.LogCommand(caller, $"css_gag {player?.SteamID} {time} {reason}");
Task.Run(async () =>
{
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time);
@@ -132,6 +124,13 @@ namespace CS2_SimpleAdmin
}
}
}
if (command != null)
{
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer);
Helper.LogCommand(caller, command);
}
}
[ConsoleCommand("css_addgag")]
@@ -155,10 +154,8 @@ namespace CS2_SimpleAdmin
return;
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
string reason = _localizer?["sa_unknown"] ?? "Unknown";
MuteManager _muteManager = new(_database);
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
@@ -175,8 +172,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0]
};
Helper.LogCommand(caller, command);
List<CCSPlayerController> matches = Helper.GetPlayerFromSteamid64(steamid);
if (matches.Count == 1)
{
@@ -237,6 +232,8 @@ namespace CS2_SimpleAdmin
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Gag, DateTime.Now.AddMinutes(time), time);
}
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Gag, _discordWebhookClientPenalty, _localizer);
}
Task.Run(async () =>
@@ -244,7 +241,13 @@ namespace CS2_SimpleAdmin
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 0);
});
command.ReplyToCommand($"Gagged player with steamid {steamid}.");
if (command != null)
{
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
}
command?.ReplyToCommand($"Gagged player with steamid {steamid}.");
}
[ConsoleCommand("css_ungag")]
@@ -264,7 +267,6 @@ namespace CS2_SimpleAdmin
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
bool found = false;
@@ -366,7 +368,7 @@ namespace CS2_SimpleAdmin
string callerName = caller == null ? "Console" : caller.PlayerName;
int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
string reason = _localizer?["sa_unknown"] ?? "Unknown";
TargetResult? targets = GetTarget(command);
if (targets == null) return;
@@ -377,8 +379,6 @@ namespace CS2_SimpleAdmin
return;
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int.TryParse(command.GetArg(2), out time);
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
@@ -391,13 +391,12 @@ namespace CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
Mute(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command);
}
});
}
internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
internal void Mute(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null)
{
if (_database == null) return;
callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -418,8 +417,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0]
};
Helper.LogCommand(caller, $"css_mute {player?.SteamID} {time} {reason}");
player!.VoiceFlags = VoiceFlags.Muted;
Task.Run(async () =>
@@ -470,6 +467,13 @@ namespace CS2_SimpleAdmin
}
}
}
if (command != null)
{
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
Helper.LogCommand(caller, command);
}
}
[ConsoleCommand("css_addmute")]
@@ -492,12 +496,8 @@ namespace CS2_SimpleAdmin
return;
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
string reason = _localizer?["sa_unknown"] ?? "Unknown";
MuteManager _muteManager = new(_database);
PlayerPenaltyManager playerPenaltyManager = new PlayerPenaltyManager();
@@ -569,6 +569,8 @@ namespace CS2_SimpleAdmin
}
}
}
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
}
Task.Run(async () =>
@@ -576,7 +578,13 @@ namespace CS2_SimpleAdmin
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 1);
});
command.ReplyToCommand($"Muted player with steamid {steamid}.");
if (command != null)
{
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
}
command?.ReplyToCommand($"Muted player with steamid {steamid}.");
}
[ConsoleCommand("css_unmute")]
@@ -596,7 +604,6 @@ namespace CS2_SimpleAdmin
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
string pattern = command.GetArg(1);
@@ -695,8 +702,6 @@ namespace CS2_SimpleAdmin
return;
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
int.TryParse(command.GetArg(2), out time);
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
@@ -709,13 +714,12 @@ namespace CS2_SimpleAdmin
{
if (caller!.CanTarget(player))
{
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Silence, _discordWebhookClientPenalty, _localizer);
Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager);
Silence(caller, player, time, reason, callerName, _muteManager, playerPenaltyManager, command);
}
});
}
internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null)
internal void Silence(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, MuteManager? muteManager = null, PlayerPenaltyManager? playerPenaltyManager = null, CommandInfo? command = null)
{
if (_database == null) return;
callerName ??= caller == null ? "Console" : caller.PlayerName;
@@ -736,8 +740,6 @@ namespace CS2_SimpleAdmin
IpAddress = caller?.IpAddress?.Split(":")[0]
};
Helper.LogCommand(caller, $"css_silence {player?.SteamID} {time} {reason}");
Task.Run(async () =>
{
await muteManager.MutePlayer(playerInfo, adminInfo, reason, time, 2);
@@ -747,7 +749,6 @@ namespace CS2_SimpleAdmin
Server.ExecuteCommand($"css_tag_mute {player!.SteamID}");
player!.VoiceFlags = VoiceFlags.Muted;
playerPenaltyManager.AddPenalty(player!.Slot, PenaltyType.Silence, DateTime.Now.AddMinutes(time), time);
if (time == 0)
@@ -796,6 +797,13 @@ namespace CS2_SimpleAdmin
}
}
}
if (command != null)
{
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
}
}
[ConsoleCommand("css_addsilence")]
@@ -818,10 +826,6 @@ namespace CS2_SimpleAdmin
return;
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
int time = 0;
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
@@ -897,6 +901,8 @@ namespace CS2_SimpleAdmin
}
}
}
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Mute, _discordWebhookClientPenalty, _localizer);
}
}
Task.Run(async () =>
@@ -904,7 +910,13 @@ namespace CS2_SimpleAdmin
await _muteManager.AddMuteBySteamid(steamid, adminInfo, reason, time, 2);
});
command.ReplyToCommand($"Silenced player with steamid {steamid}.");
if (command != null)
{
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
}
command?.ReplyToCommand($"Silenced player with steamid {steamid}.");
}
[ConsoleCommand("css_unsilence")]
@@ -924,7 +936,6 @@ namespace CS2_SimpleAdmin
}
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
Helper.LogCommand(caller, command);
string pattern = command.GetArg(1);