mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-17 18:39:07 +00:00
1.4.8b
- Improved admin loading
This commit is contained in:
@@ -39,7 +39,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||||||
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
|
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
|
||||||
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
||||||
public override string ModuleAuthor => "daffyy & Dliix66";
|
public override string ModuleAuthor => "daffyy & Dliix66";
|
||||||
public override string ModuleVersion => "1.4.8a";
|
public override string ModuleVersion => "1.4.8b";
|
||||||
|
|
||||||
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,6 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
await adminManager.CrateGroupsJsonFile();
|
await adminManager.CrateGroupsJsonFile();
|
||||||
await adminManager.CreateAdminsJsonFile();
|
await adminManager.CreateAdminsJsonFile();
|
||||||
|
|
||||||
|
|||||||
21
Events.cs
21
Events.cs
@@ -22,7 +22,7 @@ public partial class CS2_SimpleAdmin
|
|||||||
|
|
||||||
private void OnGameServerSteamAPIActivated()
|
private void OnGameServerSteamAPIActivated()
|
||||||
{
|
{
|
||||||
AddTimer(8.5f, () =>
|
AddTimer(3.0f, () =>
|
||||||
{
|
{
|
||||||
if (ServerId != null || _database == null) return;
|
if (ServerId != null || _database == null) return;
|
||||||
|
|
||||||
@@ -44,8 +44,6 @@ public partial class CS2_SimpleAdmin
|
|||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
PermissionManager adminManager = new(_database);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await using var connection = await _database.GetConnectionAsync();
|
await using var connection = await _database.GetConnectionAsync();
|
||||||
@@ -71,10 +69,16 @@ public partial class CS2_SimpleAdmin
|
|||||||
new { address });
|
new { address });
|
||||||
|
|
||||||
ServerId = serverId;
|
ServerId = serverId;
|
||||||
|
|
||||||
|
if (ServerId != null)
|
||||||
|
{
|
||||||
|
Server.NextFrame(() => ReloadAdmins(null));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger?.LogCritical("Unable to create or get server_id" + ex.Message);
|
_logger?.LogCritical("Unable to create or get server_id: " + ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.EnableMetrics)
|
if (Config.EnableMetrics)
|
||||||
@@ -337,8 +341,8 @@ public partial class CS2_SimpleAdmin
|
|||||||
|
|
||||||
public void OnMapStart(string mapName)
|
public void OnMapStart(string mapName)
|
||||||
{
|
{
|
||||||
if (Config.ReloadAdminsEveryMapChange)
|
if (Config.ReloadAdminsEveryMapChange && ServerId != null)
|
||||||
AddTimer(3.0f, () => ReloadAdmins(null));
|
AddTimer(2.0f, () => ReloadAdmins(null));
|
||||||
|
|
||||||
var path = Path.GetDirectoryName(ModuleDirectory);
|
var path = Path.GetDirectoryName(ModuleDirectory);
|
||||||
if (Directory.Exists(path + "/CS2-Tags"))
|
if (Directory.Exists(path + "/CS2-Tags"))
|
||||||
@@ -353,6 +357,7 @@ public partial class CS2_SimpleAdmin
|
|||||||
|
|
||||||
_database = new Database.Database(_dbConnectionString);
|
_database = new Database.Database(_dbConnectionString);
|
||||||
|
|
||||||
|
/*
|
||||||
AddTimer(2f, () =>
|
AddTimer(2f, () =>
|
||||||
{
|
{
|
||||||
if (ServerId != null) return;
|
if (ServerId != null) return;
|
||||||
@@ -370,8 +375,6 @@ public partial class CS2_SimpleAdmin
|
|||||||
|
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
PermissionManager adminManager = new(_database);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await using var connection = await _database.GetConnectionAsync();
|
await using var connection = await _database.GetConnectionAsync();
|
||||||
@@ -419,7 +422,7 @@ public partial class CS2_SimpleAdmin
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
AddTimer(61.0f, () =>
|
AddTimer(61.0f, () =>
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user