mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-09-27 20:17:04 +02:00
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:
parent
b97426313b
commit
5701455de0
111 changed files with 5387 additions and 2871 deletions
|
|
@ -7,7 +7,9 @@ using MenuManager;
|
|||
using Microsoft.Extensions.Localization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Concurrent;
|
||||
using CS2_SimpleAdmin.Database;
|
||||
using CS2_SimpleAdmin.Managers;
|
||||
using Timer = CounterStrikeSharp.API.Modules.Timers.Timer;
|
||||
|
||||
namespace CS2_SimpleAdmin;
|
||||
|
||||
|
|
@ -15,12 +17,13 @@ public partial class CS2_SimpleAdmin
|
|||
{
|
||||
// Config
|
||||
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
||||
|
||||
|
||||
// HttpClient
|
||||
internal static readonly HttpClient HttpClient = new();
|
||||
|
||||
|
||||
// Paths
|
||||
internal static readonly string ConfigDirectory = Path.Combine(Application.RootDirectory, "configs/plugins/CS2-SimpleAdmin");
|
||||
internal static readonly string ConfigDirectory =
|
||||
Path.Combine(Application.RootDirectory, "configs/plugins/CS2-SimpleAdmin");
|
||||
|
||||
// Localization
|
||||
public static IStringLocalizer? _localizer;
|
||||
|
|
@ -40,7 +43,9 @@ public partial class CS2_SimpleAdmin
|
|||
private static readonly HashSet<int> GodPlayers = [];
|
||||
internal static readonly HashSet<int> SilentPlayers = [];
|
||||
internal static readonly Dictionary<ulong, string> RenamedPlayers = [];
|
||||
internal static readonly ConcurrentDictionary<int, PlayerInfo> PlayersInfo = [];
|
||||
internal static readonly ConcurrentDictionary<ulong, PlayerInfo> PlayersInfo = [];
|
||||
internal static readonly List<CCSPlayerController> CachedPlayers = [];
|
||||
internal static readonly List<CCSPlayerController> BotPlayers = [];
|
||||
private static readonly List<DisconnectedPlayer> DisconnectedPlayers = [];
|
||||
|
||||
// Discord Integration
|
||||
|
|
@ -48,25 +53,35 @@ public partial class CS2_SimpleAdmin
|
|||
|
||||
// Database Settings
|
||||
internal string DbConnectionString = string.Empty;
|
||||
internal static Database.Database? Database;
|
||||
// internal static Database.Database? Database;
|
||||
internal static IDatabaseProvider? DatabaseProvider;
|
||||
|
||||
// Logger
|
||||
internal static ILogger? _logger;
|
||||
|
||||
// Memory Function (Game-related)
|
||||
private static MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>? _cBasePlayerControllerSetPawnFunc;
|
||||
private static MemoryFunctionVoid<CBasePlayerController, CCSPlayerPawn, bool, bool>?
|
||||
_cBasePlayerControllerSetPawnFunc;
|
||||
|
||||
// Menu API and Capabilities
|
||||
internal static IMenuApi? MenuApi;
|
||||
private static readonly PluginCapability<IMenuApi> MenuCapability = new("menu:nfcore");
|
||||
|
||||
// Shared API
|
||||
internal static Api.CS2_SimpleAdminApi? SimpleAdminApi { get; set; }
|
||||
|
||||
internal static Api.CS2_SimpleAdminApi? SimpleAdminApi { get; private set; }
|
||||
|
||||
// Managers
|
||||
internal PermissionManager PermissionManager = new(Database);
|
||||
internal BanManager BanManager = new(Database);
|
||||
internal MuteManager MuteManager = new(Database);
|
||||
internal WarnManager WarnManager = new(Database);
|
||||
internal PermissionManager PermissionManager = new(DatabaseProvider);
|
||||
internal BanManager BanManager = new(DatabaseProvider);
|
||||
internal MuteManager MuteManager = new(DatabaseProvider);
|
||||
internal WarnManager WarnManager = new(DatabaseProvider);
|
||||
internal CacheManager? CacheManager = new();
|
||||
private static readonly PlayerManager PlayerManager = new();
|
||||
|
||||
// Timers
|
||||
internal Timer? PlayersTimer = null;
|
||||
|
||||
// Funny list
|
||||
private readonly List<string> _requiredPlugins = ["MenuManagerCore", "PlayerSettings"];
|
||||
private readonly List<string> _requiredShared = ["MenuManagerApi", "PlayerSettingsApi", "AnyBaseLib", "CS2-SimpleAdminApi"];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue