diff --git a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java index de7d888..337ea4a 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/BauSystem.java @@ -157,6 +157,7 @@ public class BauSystem extends JavaPlugin implements Listener { if (autoShutdown != null) { autoShutdown.cancel(); } + CommandTPSLimiter.setTPS(20.0); autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() { int count = 0; diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java index 4169f1f..35101f5 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTPSLimiter.java @@ -40,6 +40,12 @@ import java.util.List; public class CommandTPSLimiter extends SWCommand { + private static CommandTPSLimiter instance = null; + + { + instance = this; + } + private static final World WORLD = Bukkit.getWorlds().get(0); private static double currentTPSLimit = 20; @@ -158,4 +164,13 @@ public class CommandTPSLimiter extends SWCommand { return (double) Math.round(currentTPSLimit * 10.0D) / 10.0D; } + public static void setTPS(double d) { + if (d < 0.5) d = 0.5; + if (d > (TPSUtils.isWarpAllowed() ? 40 : 20)) d = (TPSUtils.isWarpAllowed() ? 40 : 20); + if (instance != null) { + currentTPSLimit = d; + instance.tpsLimiter(); + } + } + }