Compare commits

..

1 Commits

Author SHA1 Message Date
Yuriy Petleshkov
4b0fd14838 Merge 84646e4451 into b2ebe136c3 2024-11-23 06:33:45 +09:00
3 changed files with 6 additions and 15 deletions

View File

@@ -30,7 +30,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
if (hotReload)
{
ServerLoaded = false;
_serverLoading = false;
OnGameServerSteamAPIActivated();
OnMapStart(string.Empty);

View File

@@ -17,8 +17,6 @@ namespace CS2_SimpleAdmin;
public partial class CS2_SimpleAdmin
{
private bool _serverLoading;
private void RegisterEvents()
{
RegisterListener<Listeners.OnMapStart>(OnMapStart);
@@ -51,10 +49,6 @@ public partial class CS2_SimpleAdmin
private void OnGameServerSteamAPIActivated()
{
if (_serverLoading)
return;
_serverLoading = true;
new ServerManager().LoadServerData();
}
@@ -340,11 +334,11 @@ public partial class CS2_SimpleAdmin
if (Config.OtherSettings.ReloadAdminsEveryMapChange && ServerLoaded && ServerId != null)
AddTimer(3.0f, () => ReloadAdmins(null));
// AddTimer(34, () =>
// {
// if (!ServerLoaded)
// OnGameServerSteamAPIActivated();
// });
AddTimer(34, () =>
{
if (!ServerLoaded)
OnGameServerSteamAPIActivated();
});
GodPlayers.Clear();
SilentPlayers.Clear();

View File

@@ -15,7 +15,7 @@ public class ServerManager
{
if (CS2_SimpleAdmin.ServerLoaded || CS2_SimpleAdmin.ServerId != null || CS2_SimpleAdmin.Database == null) return;
if (_getIpTryCount > 16 && Helper.GetServerIp().StartsWith("0.0.0.0") || string.IsNullOrEmpty(Helper.GetServerIp()))
if (_getIpTryCount > 16)
{
CS2_SimpleAdmin._logger?.LogError("Unable to load server data - can't fetch ip address!");
return;
@@ -39,8 +39,6 @@ public class ServerManager
var address = $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";
var hostname = ConVar.Find("hostname")!.StringValue;
CS2_SimpleAdmin.IpAddress = address;
CS2_SimpleAdmin._logger?.LogInformation("Loaded server with ip {ip}", ipAddress);
Task.Run(async () =>
{