Compare commits

...

9 Commits

Author SHA1 Message Date
Dawid Bepierszcz
91615ffc67 Update VERSION 2026-01-27 13:50:27 +01:00
Dawid Bepierszcz
eb9b438315 Update CS2-SimpleAdmin.cs 2026-01-27 13:47:41 +01:00
Dawid Bepierszcz
3d23b8981b Update VERSION 2026-01-27 12:21:07 +01:00
Dawid Bepierszcz
39cbfdab1e Update CS2-SimpleAdmin.cs 2026-01-27 12:20:56 +01:00
Dawid Bepierszcz
4599f08fd7 Update basecommands.cs 2026-01-27 12:20:29 +01:00
Dawid Bepierszcz
4c43f14c82 Update VERSION 2026-01-27 09:52:44 +01:00
Dawid Bepierszcz
f16f8cf1a5 Update CS2-SimpleAdmin.cs 2026-01-27 09:52:31 +01:00
Dawid Bepierszcz
193685826c Update ServerManager.cs 2026-01-27 09:51:12 +01:00
Dawid Bepierszcz
fe73fa9917 Refactor admin and server loading timing logic
Adjusted timers for admin and server data loading to improve reliability and reduce delays. Admin data is now loaded more promptly on map changes and during command execution. ServerManager now initializes the cache after setting the server ID, and redundant admin reloads have been removed. Version bumped to 1.7.8-beta-10.
2026-01-26 01:19:25 +01:00
5 changed files with 13 additions and 15 deletions

View File

@@ -22,7 +22,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";
public override string ModuleVersion => "1.7.8-beta-9";
public override string ModuleVersion => "1.7.8-beta-10b";
public override void Load(bool hotReload)
{
@@ -83,9 +83,9 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
Unload(false);
}
AddTimer(6.0f, () => ReloadAdmins(null));
RegisterEvents();
AddTimer(0.5f, RegisterCommands.InitializeCommands);
AddTimer(3.0f, () => ReloadAdmins(null));
if (!CoreConfig.UnlockConCommands)
{

View File

@@ -507,7 +507,7 @@ public partial class CS2_SimpleAdmin
var adminsFile = await File.ReadAllTextAsync(Instance.ModuleDirectory + "/data/admins.json");
var groupsFile = await File.ReadAllTextAsync(Instance.ModuleDirectory + "/data/groups.json");
await Server.NextWorldUpdateAsync(() =>
await Server.NextWorldUpdateAsync(() =>
{
AddTimer(1, () =>
{
@@ -521,7 +521,7 @@ public partial class CS2_SimpleAdmin
_logger?.LogInformation("Loaded admins!");
});
});
});
});
//_ = _adminManager.GiveAllGroupsFlags();
//_ = _adminManager.GiveAllFlags();

View File

@@ -448,13 +448,13 @@ public partial class CS2_SimpleAdmin
private void OnMapStart(string mapName)
{
if (!ServerLoaded || ServerId == null)
AddTimer(2.0f, OnGameServerSteamAPIActivated);
if (Config.OtherSettings.ReloadAdminsEveryMapChange && ServerLoaded && ServerId != null)
AddTimer(5.0f, () => ReloadAdmins(null));
ReloadAdmins(null);
AddTimer(1.0f, ServerManager.CheckHibernationStatus);
if (!ServerLoaded || ServerId == null)
AddTimer(1.5f, OnGameServerSteamAPIActivated);
// AddTimer(34, () =>
// {

View File

@@ -31,7 +31,7 @@ public class ServerManager
/// </summary>
public void LoadServerData()
{
CS2_SimpleAdmin.Instance.AddTimer(2.0f, () =>
CS2_SimpleAdmin.Instance.AddTimer(1.0f, () =>
{
if (CS2_SimpleAdmin.ServerLoaded || CS2_SimpleAdmin.DatabaseProvider == null) return;
@@ -103,14 +103,12 @@ public class ServerManager
CS2_SimpleAdmin.ServerId = serverId;
CS2_SimpleAdmin._logger?.LogInformation("Loaded server with ip {ip}", ipAddress);
if (CS2_SimpleAdmin.ServerId != null)
{
await Server.NextWorldUpdateAsync(() => CS2_SimpleAdmin.Instance.ReloadAdmins(null));
}
CS2_SimpleAdmin.ServerLoaded = true;
CS2_SimpleAdmin.ServerLoaded = true;
if (CS2_SimpleAdmin.Instance.CacheManager != null)
{
await CS2_SimpleAdmin.Instance.CacheManager.InitializeCacheAsync();
}
}
catch (Exception ex)
{

View File

@@ -1 +1 @@
1.7.8-beta-9
1.7.8-beta-10b1