From cd7890f5fe20a7362e80eae55fec8c704de54ecd Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 08:26:09 +0200 Subject: [PATCH 1/8] 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; } } From fe6a40577c4c56b2f3bacd30d36fbb28bef6ec5c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 08:29:52 +0200 Subject: [PATCH 2/8] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 1 + BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java | 1 + 2 files changed, 2 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 5a73cba..f0c5107 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -176,6 +176,7 @@ public class BauSystem extends JavaPlugin implements Listener { Bukkit.shutdown(); } } catch (Throwable throwable) { + throwable.printStackTrace(); 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 b3fc6fd..fcf5f86 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java @@ -36,6 +36,7 @@ public class RamUsage { long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize(); return (memorySize - freeMemory) / (double) memorySize; } catch (Throwable throwable) { + throwable.printStackTrace(); Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); return 1D; } From 08e0578fb476f1fa095cf0d236e86bf4c2e6d03e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 08:32:37 +0200 Subject: [PATCH 3/8] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java index fcf5f86..eb249b1 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java @@ -34,6 +34,7 @@ public class RamUsage { try { long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize(); + System.out.println((memorySize - freeMemory) / (double) memorySize); return (memorySize - freeMemory) / (double) memorySize; } catch (Throwable throwable) { throwable.printStackTrace(); From 829e3c64f07f6362ffb018765a905d5552e8cee1 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 08:33:34 +0200 Subject: [PATCH 4/8] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java index eb249b1..33a1c48 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java @@ -34,7 +34,7 @@ public class RamUsage { try { long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize(); - System.out.println((memorySize - freeMemory) / (double) memorySize); + System.out.println(memorySize + " " + freeMemory); return (memorySize - freeMemory) / (double) memorySize; } catch (Throwable throwable) { throwable.printStackTrace(); From aa4058d5f910b2562597318330ca9a1369fd7975 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 08:39:56 +0200 Subject: [PATCH 5/8] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index f0c5107..2fa43b8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -161,11 +161,13 @@ public class BauSystem extends JavaPlugin implements Listener { if (autoShutdown != null) { autoShutdown.cancel(); } + System.out.println("INIT AutoShutdown"); autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() { int count = 0; @Override public void run() { + System.out.println("RUN AutoShutdown " + count); if (count >= 300) { Bukkit.shutdown(); return; From 55435c7d184dfaa6b97b536ddd78a5cc7ac76fe4 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 3 Apr 2021 08:47:07 +0200 Subject: [PATCH 6/8] Fix log messages --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 2fa43b8..177e168 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -42,10 +42,6 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.scheduler.BukkitTask; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.management.ManagementFactory; import java.util.UUID; import java.util.logging.Level; @@ -161,13 +157,12 @@ public class BauSystem extends JavaPlugin implements Listener { if (autoShutdown != null) { autoShutdown.cancel(); } - System.out.println("INIT AutoShutdown"); autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() { int count = 0; @Override public void run() { - System.out.println("RUN AutoShutdown " + count); + Bukkit.getLogger().log(Level.INFO, "RUN AutoShutdown " + count); if (count >= 300) { Bukkit.shutdown(); return; @@ -178,7 +173,6 @@ public class BauSystem extends JavaPlugin implements Listener { Bukkit.shutdown(); } } catch (Throwable throwable) { - throwable.printStackTrace(); Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); Bukkit.shutdown(); } From 3cdff4c4b79247934c1d856801a83bb39c14b940 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 09:10:04 +0200 Subject: [PATCH 7/8] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 3 --- BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java | 2 -- 2 files changed, 5 deletions(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 2fa43b8..5a73cba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -161,13 +161,11 @@ public class BauSystem extends JavaPlugin implements Listener { if (autoShutdown != null) { autoShutdown.cancel(); } - System.out.println("INIT AutoShutdown"); autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() { int count = 0; @Override public void run() { - System.out.println("RUN AutoShutdown " + count); if (count >= 300) { Bukkit.shutdown(); return; @@ -178,7 +176,6 @@ public class BauSystem extends JavaPlugin implements Listener { Bukkit.shutdown(); } } catch (Throwable throwable) { - throwable.printStackTrace(); 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 33a1c48..b3fc6fd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/RamUsage.java @@ -34,10 +34,8 @@ public class RamUsage { try { long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize(); - System.out.println(memorySize + " " + freeMemory); return (memorySize - freeMemory) / (double) memorySize; } catch (Throwable throwable) { - throwable.printStackTrace(); Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); return 1D; } From de6b20d8278dc6b1dae3966b550032160d75e7c2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 3 Apr 2021 09:11:52 +0200 Subject: [PATCH 8/8] Hotfix BauSystem RamUsage and AutoShutdown --- BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java | 1 - 1 file changed, 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 177e168..de7d888 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -162,7 +162,6 @@ public class BauSystem extends JavaPlugin implements Listener { @Override public void run() { - Bukkit.getLogger().log(Level.INFO, "RUN AutoShutdown " + count); if (count >= 300) { Bukkit.shutdown(); return;