REST & console window title report port correctly

Fixes #443
This commit is contained in:
Lucas Nicodemus 2012-05-26 11:59:31 -06:00
parent 8ea0b40214
commit d9a53cda30
4 changed files with 7 additions and 8 deletions

View file

@ -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);

View file

@ -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))},
};

View file

@ -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 )

View file

@ -35,12 +35,12 @@ namespace TShockAPI
/// <summary>
/// Document me
/// </summary>
private const int firstItemPrefix = 1;
private const int FirstItemPrefix = 1;
/// <summary>
/// Document me
/// </summary>
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<int>();
for (int i = firstItemPrefix; i <= lastItemPrefix; i++)
for (int i = FirstItemPrefix; i <= LastItemPrefix; i++)
{
try
{
@ -511,7 +511,7 @@ namespace TShockAPI
public List<int> 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<int> {type};
}