update: Add DefaultServerIP in config

This commit is contained in:
Sachin 2025-01-16 23:27:49 +05:30
parent 6928f57111
commit eaab9e3000
3 changed files with 6 additions and 2 deletions

View file

@ -287,6 +287,7 @@
}
]
},
"DefaultServerIP": "",
"ChatLog": {
"ChatLog_Enable": true,
"ChatLog_ExcludeMessageContains": "!./",

View file

@ -303,6 +303,9 @@ public class CS2_SimpleAdminConfig : BasePluginConfig
[JsonPropertyName("MenuConfig")]
public MenuConfig MenuConfigs { get; set; } = new();
[JsonPropertyName("DefaultServerIP")]
public string DefaultServerIP { get; set; } = "";
[JsonPropertyName("ChatLog")]
public ChatLog ChatLog { get; set; } = new ChatLog();

View file

@ -46,7 +46,7 @@ public class ServerManager
}
}
var address = $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";
string? address = !string.IsNullOrWhiteSpace(CS2_SimpleAdmin.Instance.Config.DefaultServerIP) ? CS2_SimpleAdmin.Instance.Config.DefaultServerIP : $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";
var hostname = ConVar.Find("hostname")!.StringValue;
var rcon = ConVar.Find("rcon_password")!.StringValue;
CS2_SimpleAdmin.IpAddress = address;