SteamWar/BauSystem
Archiviert
13
0

Hotfix BauSystem RamUsage and AutoShutdown

Dieser Commit ist enthalten in:
yoyosource 2021-04-03 09:10:04 +02:00
Ursprung aa4058d5f9
Commit 3cdff4c4b7
2 geänderte Dateien mit 0 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -161,13 +161,11 @@ public class BauSystem extends JavaPlugin implements Listener {
if (autoShutdown != null) { if (autoShutdown != null) {
autoShutdown.cancel(); autoShutdown.cancel();
} }
System.out.println("INIT AutoShutdown");
autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() { autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
int count = 0; int count = 0;
@Override @Override
public void run() { public void run() {
System.out.println("RUN AutoShutdown " + count);
if (count >= 300) { if (count >= 300) {
Bukkit.shutdown(); Bukkit.shutdown();
return; return;
@ -178,7 +176,6 @@ public class BauSystem extends JavaPlugin implements Listener {
Bukkit.shutdown(); Bukkit.shutdown();
} }
} catch (Throwable throwable) { } catch (Throwable throwable) {
throwable.printStackTrace();
Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable);
Bukkit.shutdown(); Bukkit.shutdown();
} }

Datei anzeigen

@ -34,10 +34,8 @@ public class RamUsage {
try { try {
long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize(); long memorySize = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize(); long freeMemory = ((com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getFreePhysicalMemorySize();
System.out.println(memorySize + " " + freeMemory);
return (memorySize - freeMemory) / (double) memorySize; return (memorySize - freeMemory) / (double) memorySize;
} catch (Throwable throwable) { } catch (Throwable throwable) {
throwable.printStackTrace();
Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable); Bukkit.getLogger().log(Level.WARNING, throwable.getMessage(), throwable);
return 1D; return 1D;
} }