Adjust behavior of restarts. Closes #337

This commit is contained in:
Brant Martin
2019-08-25 11:55:14 -04:00
parent ef444730b7
commit 997a3ca31c
4 changed files with 16 additions and 9 deletions

View File

@@ -152,14 +152,15 @@ namespace Torch.Server
/// <summary>
/// Restart the program.
/// </summary>
public override void Restart()
public override void Restart(bool save = true)
{
if (Config.DisconnectOnRestart)
{
ModCommunication.SendMessageToClients(new JoinServerMessage("0.0.0.0:25555"));
Log.Info("Ejected all players from server for restart.");
}
if (IsRunning)
if (IsRunning && save)
Save().ContinueWith(DoRestart, this, TaskContinuationOptions.RunContinuationsAsynchronously);
else
DoRestart(null, this);