From cd7890f5fe20a7362e80eae55fec8c704de54ecd Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 08:26:09 +0200 Subject: [PATCH] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 2 ++ BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 44af4f7..5a73cba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -47,6 +47,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.lang.management.ManagementFactory; import java.util.UUID; +import java.util.logging.Level; public class BauSystem extends JavaPlugin implements Listener { private static BauSystem plugin; @@ -175,6 +176,7 @@ public class BauSystem extends JavaPlugin implements Listener { Bukkit.shutdown(); } } catch (Throwable throwable) { + Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); Bukkit.shutdown(); } } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java index cac2679..b3fc6fd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java @@ -19,7 +19,10 @@ package de.steamwar.bausystem; +import org.bukkit.Bukkit; + import java.lang.management.ManagementFactory; +import java.util.logging.Level; public class RamUsage { @@ -33,6 +36,7 @@ public class RamUsage { long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize(); return (memorySize - freeMemory) / (double) memorySize; } catch (Throwable throwable) { + Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); return 1D; } }