fix: Fixes shutdown+save (#1614)
This commit is contained in:
parent
21a067c187
commit
a93a363c5f
1 changed files with 14 additions and 1 deletions
|
|
@ -36,6 +36,8 @@ public static class Core
|
|||
{
|
||||
private static readonly ILogger logger = LogFactory.GetLogger(typeof(Core));
|
||||
|
||||
private static bool _performProcessKill;
|
||||
private static bool _restartOnKill;
|
||||
private static bool _performSnapshot;
|
||||
private static bool _crashed;
|
||||
private static string _baseDirectory;
|
||||
|
|
@ -304,6 +306,12 @@ public static class Core
|
|||
}
|
||||
}
|
||||
|
||||
public static void Kill(bool restart = false)
|
||||
{
|
||||
_performProcessKill = true;
|
||||
_restartOnKill = restart;
|
||||
}
|
||||
|
||||
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
Console.WriteLine(e.IsTerminating ? "Error:" : "Warning:");
|
||||
|
|
@ -359,7 +367,7 @@ public static class Core
|
|||
Kill();
|
||||
}
|
||||
|
||||
public static void Kill(bool restart = false)
|
||||
internal static void DoKill(bool restart = false)
|
||||
{
|
||||
if (Closing)
|
||||
{
|
||||
|
|
@ -569,6 +577,11 @@ public static class Core
|
|||
World.Snapshot();
|
||||
}
|
||||
|
||||
if (_performProcessKill)
|
||||
{
|
||||
DoKill(_restartOnKill);
|
||||
}
|
||||
|
||||
_tickCount = 0;
|
||||
_now = DateTime.MinValue;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue