1.6.9a
- 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:
parent
70a62d4b63
commit
b2ebe136c3
17 changed files with 175 additions and 41 deletions
|
|
@ -106,7 +106,7 @@ public class PermissionManager(Database.Database? database)
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CS2_SimpleAdmin._logger?.LogError(ex.ToString());
|
||||
CS2_SimpleAdmin._logger?.LogError("Unable to load admins from database! {exception}", ex.Message);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ public class PermissionManager(Database.Database? database)
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CS2_SimpleAdmin._logger?.LogError(ex.ToString());
|
||||
CS2_SimpleAdmin._logger?.LogError("Unable to load groups from database! {exception}", ex.Message);
|
||||
}
|
||||
|
||||
return [];
|
||||
|
|
@ -371,7 +371,6 @@ public class PermissionManager(Database.Database? database)
|
|||
public async Task DeleteAdminBySteamId(string playerSteamId, bool globalDelete = false)
|
||||
{
|
||||
if (database == null) return;
|
||||
|
||||
if (string.IsNullOrEmpty(playerSteamId)) return;
|
||||
|
||||
//_adminCache.TryRemove(playerSteamId, out _);
|
||||
|
|
@ -453,7 +452,7 @@ public class PermissionManager(Database.Database? database)
|
|||
});
|
||||
}
|
||||
|
||||
await Server.NextFrameAsync(() =>
|
||||
await Server.NextWorldUpdateAsync(() =>
|
||||
{
|
||||
CS2_SimpleAdmin.Instance.ReloadAdmins(null);
|
||||
});
|
||||
|
|
@ -500,7 +499,7 @@ public class PermissionManager(Database.Database? database)
|
|||
|
||||
await connection.ExecuteAsync(insertGroupServer, new { groupId, server_id = globalGroup ? null : CS2_SimpleAdmin.ServerId });
|
||||
|
||||
await Server.NextFrameAsync(() =>
|
||||
await Server.NextWorldUpdateAsync(() =>
|
||||
{
|
||||
CS2_SimpleAdmin.Instance.ReloadAdmins(null);
|
||||
});
|
||||
|
|
@ -508,7 +507,7 @@ public class PermissionManager(Database.Database? database)
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CS2_SimpleAdmin._logger?.LogError(ex.ToString());
|
||||
CS2_SimpleAdmin._logger?.LogError("Problem with loading admins: {exception}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,11 @@ public class PlayerManager
|
|||
|
||||
try
|
||||
{
|
||||
if (!CS2_SimpleAdmin.PlayersInfo.ContainsKey(userId))
|
||||
{
|
||||
Helper.KickPlayer(userId, NetworkDisconnectionReason.NETWORK_DISCONNECT_REJECT_INVALIDCONNECTION);
|
||||
}
|
||||
|
||||
// Check if the player is banned
|
||||
var isBanned = await CS2_SimpleAdmin.Instance.BanManager.IsPlayerBanned(CS2_SimpleAdmin.PlayersInfo[userId]);
|
||||
|
||||
|
|
@ -194,7 +199,7 @@ public class PlayerManager
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CS2_SimpleAdmin._logger?.LogError($"Error processing player connection: {ex}");
|
||||
CS2_SimpleAdmin._logger?.LogError("Error processing player connection: {exception}", ex.Message);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -263,7 +268,7 @@ public class PlayerManager
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
CS2_SimpleAdmin._logger?.LogError($"Unexpected error: {ex.Message}");
|
||||
CS2_SimpleAdmin._logger?.LogError("Unexpected error: {exception}", ex.Message);
|
||||
}
|
||||
|
||||
CS2_SimpleAdmin.BannedPlayers.Clear();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue