Refactor database layer and add module/plugin improvements

Reworked the database layer to support both MySQL and SQLite via new provider classes and migration scripts for each backend. Updated the build workflow to support building and packaging additional modules, including StealthModule and BanSoundModule, and improved artifact handling. Refactored command registration to allow dynamic registration/unregistration and improved API event handling. Updated dependencies, project structure, and configuration checks for better reliability and extensibility. Added new language files, updated versioning, and removed obsolete files.

**⚠️ Warning: SQLite support is currently experimental.
Using this version requires reconfiguration of your database settings!
Plugin now uses UTC time. Please adjust your configurations accordingly!
**
This commit is contained in:
Dawid Bepierszcz 2025-10-03 01:37:03 +02:00
parent b97426313b
commit 5701455de0
111 changed files with 5387 additions and 2871 deletions

View file

@ -8,6 +8,11 @@ namespace CS2_SimpleAdmin;
public partial class CS2_SimpleAdmin
{
/// <summary>
/// Enables or disables no-clip mode for specified player(s).
/// </summary>
/// <param name="caller">The player issuing the command.</param>
/// <param name="command">The command input containing targets.</param>
[CommandHelper(1, "<#userid or name>")]
[RequiresPermissions("@css/cheats")]
public void OnNoclipCommand(CCSPlayerController? caller, CommandInfo command)
@ -31,6 +36,13 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, command);
}
/// <summary>
/// Toggles no-clip mode for a player and shows admin activity messages.
/// </summary>
/// <param name="caller">The player/admin toggling no-clip.</param>
/// <param name="player">The target player whose no-clip state changes.</param>
/// <param name="callerName">Optional caller name for messages.</param>
/// <param name="command">Optional command info for logging.</param>
internal static void NoClip(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null)
{
if (!player.IsValid) return;
@ -58,6 +70,12 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, $"css_noclip {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)}");
}
/// <summary>
/// Enables or disables god mode for specified player(s).
/// </summary>
/// <param name="caller">The player issuing the command.</param>
/// <param name="command">The command input containing targets.</param>
[RequiresPermissions("@css/cheats")]
[CommandHelper(minArgs: 1, usage: "<#userid or name>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
public void OnGodCommand(CCSPlayerController? caller, CommandInfo command)
@ -82,6 +100,12 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, command);
}
/// <summary>
/// Toggles god mode for a player and notifies admins.
/// </summary>
/// <param name="caller">The player/admin toggling god mode.</param>
/// <param name="player">The target player whose god mode changes.</param>
/// <param name="command">Optional command info for logging.</param>
internal static void God(CCSPlayerController? caller, CCSPlayerController player, CommandInfo? command = null)
{
if (!caller.CanTarget(player)) return;
@ -111,6 +135,11 @@ public partial class CS2_SimpleAdmin
}
}
/// <summary>
/// Freezes target player(s) for an optional specified duration.
/// </summary>
/// <param name="caller">The player issuing the freeze command.</param>
/// <param name="command">The command input containing targets and duration.</param>
[CommandHelper(1, "<#userid or name> [duration]")]
[RequiresPermissions("@css/slay")]
public void OnFreezeCommand(CCSPlayerController? caller, CommandInfo command)
@ -133,6 +162,11 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, command);
}
/// <summary>
/// Resizes the target player(s) models to a specified scale.
/// </summary>
/// <param name="caller">The player issuing the resize command.</param>
/// <param name="command">The command input containing targets and scale factor.</param>
[CommandHelper(1, "<#userid or name> [size]")]
[RequiresPermissions("@css/slay")]
public void OnResizeCommand(CCSPlayerController? caller, CommandInfo command)
@ -153,8 +187,8 @@ public partial class CS2_SimpleAdmin
sceneNode.GetSkeletonInstance().Scale = size;
player.PlayerPawn.Value.AcceptInput("SetScale", null, null, size.ToString(CultureInfo.InvariantCulture));
Server.NextFrame(() =>
Server.NextWorldUpdate(() =>
{
Utilities.SetStateChanged(player.PlayerPawn.Value, "CBaseEntity", "m_CBodyComponent");
});
@ -173,6 +207,14 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, command);
}
/// <summary>
/// Freezes a single player and optionally schedules automatic unfreeze after a duration.
/// </summary>
/// <param name="caller">The player/admin freezing the player.</param>
/// <param name="player">The player to freeze.</param>
/// <param name="time">Duration of freeze in seconds.</param>
/// <param name="callerName">Optional name for notifications.</param>
/// <param name="command">Optional command info for logging.</param>
internal static void Freeze(CCSPlayerController? caller, CCSPlayerController player, int time, string? callerName = null, CommandInfo? command = null)
{
if (!player.IsValid) return;
@ -206,6 +248,11 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, $"css_freeze {(string.IsNullOrEmpty(player.PlayerName) ? player.SteamID.ToString() : player.PlayerName)} {time}");
}
/// <summary>
/// Unfreezes target player(s).
/// </summary>
/// <param name="caller">The player issuing the unfreeze command.</param>
/// <param name="command">The command input with targets.</param>
[CommandHelper(1, "<#userid or name>")]
[RequiresPermissions("@css/slay")]
public void OnUnfreezeCommand(CCSPlayerController? caller, CommandInfo command)
@ -224,6 +271,13 @@ public partial class CS2_SimpleAdmin
Helper.LogCommand(caller, command);
}
/// <summary>
/// Unfreezes a single player and notifies admins.
/// </summary>
/// <param name="caller">The player/admin unfreezing the player.</param>
/// <param name="player">The player to unfreeze.</param>
/// <param name="callerName">Optional name for notifications.</param>
/// <param name="command">Optional command info for logging.</param>
internal static void Unfreeze(CCSPlayerController? caller, CCSPlayerController player, string? callerName = null, CommandInfo? command = null)
{
if (!player.IsValid) return;