From 18ee7eccab70dba7d7dbc1123b613946c8712318 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Wed, 13 Jul 2011 17:25:20 -0600 Subject: [PATCH] -port works --- TShockAPI/TShock.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index b14ca2c5..35c76e4b 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -67,6 +67,7 @@ namespace TShockAPI public static IDbConnection DB; public static Process p; + public static bool OverridePort = false; public override Version Version { @@ -265,6 +266,14 @@ namespace TShockAPI Log.ConsoleInfo("World path has been set to " + path); } } + if (parms[i].ToLower() == "-port") + { + int port = Convert.ToInt32(parms[++i]); + Netplay.serverPort = port; + Config.ServerPort = port; + OverridePort = true; + Log.ConsoleInfo("Port overridden by startup argument. Set to " + port); + } } } @@ -701,8 +710,10 @@ namespace TShockAPI Main.autoSave = file.AutoSave; Backups.KeepFor = file.BackupKeepFor; Backups.Interval = file.BackupInterval; - - Netplay.serverPort = file.ServerPort; + if (!OverridePort) + { + Netplay.serverPort = file.ServerPort; + } Netplay.spamCheck = file.SpamChecks;