From c215ff8e102ae0f42558ae3f6ce69eddee06e279 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 25 Feb 2015 00:26:47 -0700 Subject: [PATCH] Console title now says "zero" with "zero" players "online" --- TShockAPI/TShock.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index fdae3db9..436acbea 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -584,7 +584,7 @@ namespace TShockAPI private void OnPostInit(EventArgs args) { - SetConsoleTitle(); + SetConsoleTitle(false); if (!File.Exists(Path.Combine(SavePath, "auth.lck")) && !File.Exists(Path.Combine(SavePath, "authcode.txt"))) { var r = new Random((int) DateTime.Now.ToBinary()); @@ -838,14 +838,14 @@ namespace TShockAPI } } } - SetConsoleTitle(); + SetConsoleTitle(false); } - private void SetConsoleTitle() + private void SetConsoleTitle(bool empty) { Console.Title = string.Format("{0}{1}/{2} @ {3}:{4} (TerrariaShock v{5})", !string.IsNullOrWhiteSpace(Config.ServerName) ? Config.ServerName + " - " : "", - Utils.ActivePlayers(), + empty ? 0 : Utils.ActivePlayers(), Config.MaxSlots, Netplay.serverListenIP, Netplay.serverPort, Version); } @@ -1027,6 +1027,7 @@ namespace TShockAPI if (Utils.ActivePlayers() == 1) { SaveManager.Instance.SaveWorld(); + SetConsoleTitle(true); } }