Skip to content

Commit

Permalink
1.4.4b
Browse files Browse the repository at this point in the history
- Fetch admins and groups data only once
- Added missing migration
  • Loading branch information
daffyyyy committed May 16, 2024
1 parent fc2958c commit 873fed1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
9 changes: 7 additions & 2 deletions CS2-SimpleAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

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();
Expand All @@ -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();

Expand All @@ -63,6 +63,11 @@ public override void Unload(bool hotReload)
RemoveCommandListener("say", OnCommandSay, HookMode.Post);
RemoveCommandListener("say_team", OnCommandTeamSay, HookMode.Post);
}

public override void OnAllPluginsLoaded(bool hotReload)
{
AddTimer(0.2f, () => ReloadAdmins(null));
}

public void OnConfigParsed(CS2_SimpleAdminConfig config)
{
Expand Down
2 changes: 1 addition & 1 deletion Commands/basecommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public void ReloadAdmins(CCSPlayerController? caller)

await Server.NextFrameAsync(() =>
{
AddTimer(0.2f, () =>
AddTimer(0.1f, () =>
{
AdminManager.LoadAdminData(ModuleDirectory + "/data/admins.json");
AdminManager.LoadAdminGroups(ModuleDirectory + "/data/groups.json");
Expand Down
1 change: 1 addition & 0 deletions Database/Migrations/008_OnlineTimeInPenalties.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `sa_mutes` ADD `passed` INT NULL AFTER `duration`;
11 changes: 1 addition & 10 deletions Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private void RegisterEvents()
AddCommandListener("say", OnCommandSay);
AddCommandListener("say_team", OnCommandTeamSay);
}

[GameEventHandler]
public HookResult OnClientDisconnect(EventPlayerDisconnect @event, GameEventInfo info)
{
Expand Down Expand Up @@ -331,15 +331,6 @@ await connection.ExecuteAsync(
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);

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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**


Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.4a
1.4.4b

0 comments on commit 873fed1

Please sign in to comment.