From f2a08e0e56dea0a1583b87b8008194501fc4da5b Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 14 Sep 2022 12:20:24 +0200 Subject: [PATCH] Finaler Rettungsstuss (gegen untote Server) --- SpigotCore_Main/src/de/steamwar/core/CrashDetector.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java b/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java index c267c1d..1320c2c 100644 --- a/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java +++ b/SpigotCore_Main/src/de/steamwar/core/CrashDetector.java @@ -54,8 +54,12 @@ public class CrashDetector { if(mainThread.isAlive()) { SWException.log("Server hung for " + (curTime - lastTick.get()) + "ms", Arrays.stream(mainThread.getStackTrace()).map(StackTraceElement::toString).collect(Collectors.joining("\n"))); } else { - SWException.log("Server thread already dead, stopping server", ""); - System.exit(0); + SWException.log("Server thread already dead, unclean server stop", "Core enabled: " + Core.getInstance().isEnabled()); + if(Core.getInstance().isEnabled()) { + Core.getInstance().onDisable(); + } + //System.exit(0); Does freeze, potential freezing issues: ConsoleRestoreHook, ApplicationShutdownHooks or DeleteOnExitHook + Runtime.getRuntime().halt(0); } lastTick.set(curTime); } -- 2.39.5