mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-17 18:39:07 +00: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:
31
Modules/CS2-SimpleAdmin_StealthModule/Extensions.cs
Normal file
31
Modules/CS2-SimpleAdmin_StealthModule/Extensions.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace CS2_SimpleAdmin_StealthModule;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static CCSPlayerController? GetSpectatingPlayer(this CCSPlayerController player)
|
||||
{
|
||||
if (player.Pawn.Value is not { IsValid: true } pawn)
|
||||
return null;
|
||||
|
||||
if (player.ControllingBot)
|
||||
return null;
|
||||
|
||||
if (pawn.ObserverServices is not { } observerServices)
|
||||
return null;
|
||||
|
||||
if (observerServices.ObserverTarget?.Value?.As<CCSPlayerPawn>() is not { IsValid: true } observerPawn)
|
||||
return null;
|
||||
|
||||
return observerPawn.OriginalController.Value is not { IsValid: true } observerController ? null : observerController;
|
||||
}
|
||||
|
||||
public static List<CCSPlayerController> GetSpectators(this CCSPlayerController player)
|
||||
{
|
||||
return CS2_SimpleAdmin_StealthModule.Players
|
||||
.Where(p => p.GetSpectatingPlayer()?.Slot == player.Slot)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user