From d9a53cda3017315173f1b8250fddc0395f8ee793 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sat, 26 May 2012 11:59:31 -0600 Subject: [PATCH] REST & console window title report port correctly Fixes #443 --- TShockAPI/GetDataHandlers.cs | 3 +-- TShockAPI/Rest/RestManager.cs | 2 +- TShockAPI/TShock.cs | 2 +- TShockAPI/Utils.cs | 8 ++++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index eb0b0c05..800516a6 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1405,8 +1405,7 @@ namespace TShockAPI { if (args.Player.RequestedSection) return true; - - args.Player.RequestedSection = true; + args.Player.RequestedSection = true; if (TShock.HackedHealth(args.Player) && !args.Player.Group.HasPermission(Permissions.ignorestathackdetection)) { TShock.Utils.ForceKick(args.Player, "You have Hacked Health/Mana, Please use a different character.", true); diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index d3ea639f..3e303777 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -127,7 +127,7 @@ namespace TShockAPI return new RestObject() { {"name", TShock.Config.ServerNickname}, - {"port", Convert.ToString(TShock.Config.ServerPort)}, + {"port", Convert.ToString(Netplay.serverPort)}, {"playercount", Convert.ToString(activeplayers.Count())}, {"players", string.Join(", ", activeplayers.Select(p => p.name))}, }; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index dd99422e..ae975e26 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -623,7 +623,7 @@ namespace TShockAPI private void SetConsoleTitle() { Console.Title = string.Format("{0} - {1}/{2} @ {3}:{4} (TerrariaShock v{5})", Config.ServerName, Utils.ActivePlayers(), - Config.MaxSlots, Netplay.serverListenIP, Config.ServerPort, Version); + Config.MaxSlots, Netplay.serverListenIP, Netplay.serverPort, Version); } private void OnHardUpdate( HardUpdateEventArgs args ) diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index 7f758935..6c974788 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -35,12 +35,12 @@ namespace TShockAPI /// /// Document me /// - private const int firstItemPrefix = 1; + private const int FirstItemPrefix = 1; /// /// Document me /// - private const int lastItemPrefix = 83; + private const int LastItemPrefix = 83; // Utils is a Singleton private static readonly Utils instance = new Utils(); @@ -471,7 +471,7 @@ namespace TShockAPI item.SetDefaults(0); string lowerName = name.ToLower(); var found = new List(); - for (int i = firstItemPrefix; i <= lastItemPrefix; i++) + for (int i = FirstItemPrefix; i <= LastItemPrefix; i++) { try { @@ -511,7 +511,7 @@ namespace TShockAPI public List GetPrefixByIdOrName(string idOrName) { int type = -1; - if (int.TryParse(idOrName, out type) && type >= firstItemPrefix && type <= lastItemPrefix) + if (int.TryParse(idOrName, out type) && type >= FirstItemPrefix && type <= LastItemPrefix) { return new List {type}; }