- Added `IsAdminSilent` to api
- Fixed disabling noclip via admin menu
- Fixed (?) hibernation problem
- Added discord webhook fire when adding ban or mute for offline player
- Updated css and mysqlconnector
This commit is contained in:
Dawid Bepierszcz 2024-11-22 22:31:06 +01:00
parent 70a62d4b63
commit b2ebe136c3
17 changed files with 175 additions and 41 deletions

View file

@ -14,19 +14,23 @@ public class ServerManager
CS2_SimpleAdmin.Instance.AddTimer(2.0f, () =>
{
if (CS2_SimpleAdmin.ServerLoaded || CS2_SimpleAdmin.ServerId != null || CS2_SimpleAdmin.Database == null) return;
if (_getIpTryCount > 16)
{
CS2_SimpleAdmin._logger?.LogError("Unable to load server data - can't fetch ip address!");
return;
}
var ipAddress = ConVar.Find("ip")?.StringValue;
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
{
ipAddress = Helper.GetServerIp();
}
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
{
if (_getIpTryCount < 12)
if (_getIpTryCount <= 16)
{
_getIpTryCount++;
LoadServerData();
return;
}
@ -54,7 +58,7 @@ public class ServerManager
else
{
await connection.ExecuteAsync(
"UPDATE `sa_servers` SET `hostname` = @hostname, `id` = `id` WHERE `address` = @address",
"UPDATE `sa_servers` SET `hostname` = @hostname WHERE `address` = @address",
new { address, hostname });
}
@ -66,7 +70,7 @@ public class ServerManager
if (CS2_SimpleAdmin.ServerId != null)
{
await Server.NextFrameAsync(() => CS2_SimpleAdmin.Instance.ReloadAdmins(null));
await Server.NextWorldUpdateAsync(() => CS2_SimpleAdmin.Instance.ReloadAdmins(null));
}
CS2_SimpleAdmin.ServerLoaded = true;