Changed the online player count alert message

This commit is contained in:
Brett Hewitson 2022-06-25 16:04:39 +10:00
parent e671abd640
commit 5d58f51e42
2 changed files with 12 additions and 8 deletions

View file

@ -333,13 +333,15 @@ namespace ServerManagerTool.Lib
break;
}
if (this.Players != update.OnlinePlayerCount)
{
PluginHelper.Instance.ProcessAlert(AlertType.OnlinePlayerCountChanged, this.ProfileSnapshot.ProfileName, $"{Config.Default.Alert_OnlinePlayerCountChange} {update.OnlinePlayerCount}");
}
var previousOnlinePlayerCount = this.Players;
this.Players = update.OnlinePlayerCount;
this.MaxPlayers = update.ServerInfo?.MaxPlayers ?? this.ProfileSnapshot.MaxPlayerCount;
if (previousOnlinePlayerCount != this.Players)
{
PluginHelper.Instance.ProcessAlert(AlertType.OnlinePlayerCountChanged, this.ProfileSnapshot.ProfileName, $"{Config.Default.Alert_OnlinePlayerCountChange} {this.Players} / {this.MaxPlayers}");
}
if (update.ServerInfo != null)
{
var match = Regex.Match(update.ServerInfo.Name, @"\(v([0-9]+\.[0-9]*)\)");

View file

@ -332,13 +332,15 @@ namespace ServerManagerTool.Lib
break;
}
if (this.Players != update.OnlinePlayerCount)
{
PluginHelper.Instance.ProcessAlert(AlertType.OnlinePlayerCountChanged, this.ProfileSnapshot.ProfileName, $"{Config.Default.Alert_OnlinePlayerCountChange} {update.OnlinePlayerCount}");
}
var previousOnlinePlayerCount = this.Players;
this.Players = update.OnlinePlayerCount;
this.MaxPlayers = update.ServerInfo?.MaxPlayers ?? this.ProfileSnapshot.MaxPlayerCount;
if (previousOnlinePlayerCount != this.Players)
{
PluginHelper.Instance.ProcessAlert(AlertType.OnlinePlayerCountChanged, this.ProfileSnapshot.ProfileName, $"{Config.Default.Alert_OnlinePlayerCountChange} {this.Players} / {this.MaxPlayers}");
}
var serverExeFile = Path.Combine(this.ProfileSnapshot.InstallDirectory, Config.Default.ServerBinaryRelativePath, Config.Default.ServerExeFile);
if (!string.IsNullOrWhiteSpace(serverExeFile) && File.Exists(serverExeFile))
{