- Fetch admins and groups data only once
- Added missing migration
This commit is contained in:
Dawid Bepierszcz
2024-05-16 21:51:13 +02:00
parent fc2958c84f
commit 873fed17c9
6 changed files with 13 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ using System.Collections.Concurrent;
namespace CS2_SimpleAdmin;
[MinimumApiVersion(225)]
[MinimumApiVersion(228)]
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
{
public static CS2_SimpleAdmin Instance { get; private set; } = new();
@@ -37,7 +37,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy & Dliix66";
public override string ModuleVersion => "1.4.4a";
public override string ModuleVersion => "1.4.4b";
public CS2_SimpleAdminConfig Config { get; set; } = new();
@@ -64,6 +64,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
RemoveCommandListener("say_team", OnCommandTeamSay, HookMode.Post);
}
public override void OnAllPluginsLoaded(bool hotReload)
{
AddTimer(0.2f, () => ReloadAdmins(null));
}
public void OnConfigParsed(CS2_SimpleAdminConfig config)
{
if (config.DatabaseHost.Length < 1 || config.DatabaseName.Length < 1 || config.DatabaseUser.Length < 1)

View File

@@ -321,7 +321,7 @@ namespace CS2_SimpleAdmin
await Server.NextFrameAsync(() =>
{
AddTimer(0.2f, () =>
AddTimer(0.1f, () =>
{
AdminManager.LoadAdminData(ModuleDirectory + "/data/admins.json");
AdminManager.LoadAdminGroups(ModuleDirectory + "/data/groups.json");

View File

@@ -0,0 +1 @@
ALTER TABLE `sa_mutes` ADD `passed` INT NULL AFTER `duration`;

View File

@@ -331,15 +331,6 @@ public partial class CS2_SimpleAdmin
Logger.LogWarning($"Unable to make metrics call: {ex.Message}");
}
}
//await _adminManager.GiveAllGroupsFlags();
//await _adminManager.GiveAllFlags();
await Server.NextFrameAsync(() =>
{
ReloadAdmins(null);
});
});
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);

View File

@@ -14,7 +14,7 @@ Manage your Counter-Strike 2 server by simple commands :)
```js
- css_addadmin <steamid> <name> <flags/groups> <immunity> [time in minutes] - Add admin by steamid // @css/root
- css_deladmin <steamid> - Delete admin by steamid // @css/root
- css_reladmin - Reload sql admins // @css/root
- css_reloadadmins - Reload sql admins // @css/root
- css_hide - Hide admin on scoreboard and commands action // @css/kick
- css_admin - Display all admin commands // @css/generic
- css_who <#userid or name> - Display informations about player // @css/generic
@@ -62,7 +62,7 @@ Manage your Counter-Strike 2 server by simple commands :)
```
### Requirements
- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on v201**
- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on 228**
- MySQL **tested on MySQL (MariaDB) Server version: 10.11.4-MariaDB-1~deb12u1 Debian 12**

View File

@@ -1 +1 @@
1.4.4a
1.4.4b