mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 02:41:55 +00:00
Added translation
- Minor changes - Version bump - Added translation
This commit is contained in:
@@ -4,7 +4,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
|
||||
@@ -20,7 +19,7 @@ namespace CS2_SimpleAdmin
|
||||
if (command.ArgCount < 2)
|
||||
return;
|
||||
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
TargetResult? targets = GetTarget(command);
|
||||
if (targets == null) return;
|
||||
@@ -31,10 +30,7 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Database database = new Database(dbConnectionString);
|
||||
|
||||
Database database = new(dbConnectionString);
|
||||
BanManager _banManager = new(database, Config);
|
||||
|
||||
int.TryParse(command.GetArg(2), out int time);
|
||||
@@ -46,12 +42,12 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
if (caller!.CanTarget(player))
|
||||
{
|
||||
Ban(caller, player, time, reason, callerName, _banManager);
|
||||
Ban(caller, player, time, reason, callerName, _banManager, command);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null)
|
||||
internal void Ban(CCSPlayerController? caller, CCSPlayerController player, int time, string reason, string? callerName = null, BanManager? banManager = null, CommandInfo? command = null)
|
||||
{
|
||||
if (_database == null) return;
|
||||
|
||||
@@ -76,8 +72,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, $"css_ban {player.SteamID} {time} {reason}");
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
banManager ??= new BanManager(_database, Config);
|
||||
@@ -133,6 +127,12 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
}
|
||||
|
||||
@@ -155,12 +155,9 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
Database database = new Database(dbConnectionString);
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
Database database = new(dbConnectionString);
|
||||
BanManager _banManager = new(database, Config);
|
||||
|
||||
int.TryParse(command.GetArg(2), out int time);
|
||||
@@ -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)
|
||||
{
|
||||
@@ -235,6 +230,7 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
}
|
||||
|
||||
@@ -244,7 +240,14 @@ namespace CS2_SimpleAdmin
|
||||
await _banManager.AddBanBySteamid(steamid, adminInfo, reason, time);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Banned player with steamid {steamid}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
//Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
|
||||
command?.ReplyToCommand($"Banned player with steamid {steamid}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_banip")]
|
||||
@@ -269,7 +272,7 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
string reason = CS2_SimpleAdmin._localizer?["sa_unknown"] ?? "Unknown";
|
||||
string reason = _localizer?["sa_unknown"] ?? "Unknown";
|
||||
|
||||
PlayerInfo adminInfo = new PlayerInfo
|
||||
{
|
||||
@@ -278,8 +281,6 @@ namespace CS2_SimpleAdmin
|
||||
IpAddress = caller?.IpAddress?.Split(":")[0]
|
||||
};
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
int.TryParse(command.GetArg(2), out int time);
|
||||
|
||||
if (command.ArgCount >= 3 && command.GetArg(3).Length > 0)
|
||||
@@ -347,7 +348,6 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
Helper.KickPlayer(player.UserId.Value, "Banned");
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
}
|
||||
}
|
||||
Helper.SendDiscordPenaltyMessage(caller, player, reason, time, Helper.PenaltyType.Ban, _discordWebhookClientPenalty, _localizer);
|
||||
@@ -359,7 +359,13 @@ namespace CS2_SimpleAdmin
|
||||
await _banManager.AddBanByIp(ipAddress, adminInfo, reason, time);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($"Banned player with IP address {ipAddress}.");
|
||||
if (command != null)
|
||||
{
|
||||
Helper.LogCommand(caller, command);
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
}
|
||||
|
||||
command?.ReplyToCommand($"Banned player with IP address {ipAddress}.");
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_unban")]
|
||||
@@ -376,15 +382,14 @@ namespace CS2_SimpleAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
string pattern = command.GetArg(1);
|
||||
|
||||
BanManager _banManager = new BanManager(_database, Config);
|
||||
BanManager _banManager = new(_database, Config);
|
||||
Task.Run(async () => await _banManager.UnbanPlayer(pattern));
|
||||
|
||||
Helper.SendDiscordLogMessage(caller, command, _discordWebhookClientLog, _localizer);
|
||||
Helper.LogCommand(caller, command);
|
||||
|
||||
command.ReplyToCommand($"Unbanned player with pattern {pattern}.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user