diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index 85d6aed..dd6e8c9 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -43,6 +43,9 @@ 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.util.UUID; import java.util.logging.Level; @@ -168,7 +171,19 @@ public class BauSystem extends JavaPlugin implements Listener { if (autoShutdown != null) { autoShutdown.cancel(); } - autoShutdown = Bukkit.getScheduler().runTaskLater(this, Bukkit::shutdown, 1200); + /*autoShutdown = Bukkit.getScheduler().runTaskTimer(this, () -> { + try { + ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c", "free"); + Process process = processBuilder.start(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); + bufferedReader.readLine(); + String s = bufferedReader.readLine(); + } catch (IOException exception) { + Bukkit.shutdown(); + } + }, 1200, 1200);*/ + // (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().freeMemory()) / Runtime.getRuntime().maxMemory() > 0.8 + autoShutdown = Bukkit.getScheduler().runTaskLater(this, Bukkit::shutdown, 6000); } }