- Added `css_sa_upgrade` command
This commit is contained in:
Dawid Bepierszcz
2024-02-11 03:39:42 +01:00
parent 79bbe0f4c5
commit 0b2a520a07
3 changed files with 35 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.3.0d";
public override string ModuleVersion => "1.3.0e";
public CS2_SimpleAdminConfig Config { get; set; } = new();
@@ -121,6 +121,34 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
_localizer = Localizer;
}
[ConsoleCommand("css_sa_upgrade")]
[CommandHelper(whoCanExecute: CommandUsage.SERVER_ONLY)]
public void OnSaUpgradeCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller != null || _database == null) return;
Task.Run(async () =>
{
try
{
using (var connection = await _database.GetConnectionAsync())
{
var commandText = "ALTER TABLE `sa_mutes` CHANGE `type` `type` ENUM('GAG','MUTE', 'SILENCE', '') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'GAG';";
using (var command = connection.CreateCommand())
{
command.CommandText = commandText;
await command.ExecuteNonQueryAsync();
}
}
}
catch (Exception ex)
{
Logger.LogError($"{ex.Message}");
}
});
}
[ConsoleCommand("css_admin")]
[RequiresPermissions("@css/generic")]
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)