Refactored server stop and world save operations fixing race conditions so as to ensure operations always happen in a predicable order. This fixes output not appearing in the console / log for example. This adds TShock.Utils.StopServer method used by IGA, rcon and the RestAPI.

Fixed console title set not working

Optimised command line parsing

Made Utils a singleton to enforce the fact that only one copy should ever exist

Added name to /v2/user/read output as users can be found by id
This commit is contained in:
stevenh 2012-02-20 22:31:16 +00:00
parent 84789ff4d5
commit d34199b17d
7 changed files with 228 additions and 121 deletions

View file

@ -63,11 +63,7 @@ namespace TShockAPI
TShock.Utils.Broadcast("Server map saving, potential lag spike");
Console.WriteLine("Backing up world...");
Thread SaveWorld = new Thread(TShock.Utils.SaveWorld);
SaveWorld.Start();
while (SaveWorld.ThreadState == ThreadState.Running)
Thread.Sleep(50);
SaveManager.Instance.SaveWorld();
Console.WriteLine("World backed up");
Console.ForegroundColor = ConsoleColor.Gray;
Log.Info(string.Format("World backed up ({0})", Main.worldPathName));