SteamWar/BauSystem
Archiviert
13
0

Fix CommandTPSLimiter bug

Dieser Commit ist enthalten in:
yoyosource 2021-04-03 18:00:56 +02:00
Ursprung 3e3b790199
Commit a10a60a0de
2 geänderte Dateien mit 14 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -157,6 +157,7 @@ public class BauSystem extends JavaPlugin implements Listener {
if (autoShutdown != null) { if (autoShutdown != null) {
autoShutdown.cancel(); autoShutdown.cancel();
} }
CommandTPSLimiter.setTPS(20.0);
autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() { autoShutdown = Bukkit.getScheduler().runTaskTimer(this, new Runnable() {
int count = 0; int count = 0;

Datei anzeigen

@ -40,6 +40,12 @@ import java.util.List;
public class CommandTPSLimiter extends SWCommand { public class CommandTPSLimiter extends SWCommand {
private static CommandTPSLimiter instance = null;
{
instance = this;
}
private static final World WORLD = Bukkit.getWorlds().get(0); private static final World WORLD = Bukkit.getWorlds().get(0);
private static double currentTPSLimit = 20; private static double currentTPSLimit = 20;
@ -158,4 +164,11 @@ public class CommandTPSLimiter extends SWCommand {
return (double) Math.round(currentTPSLimit * 10.0D) / 10.0D; 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);
currentTPSLimit = d;
instance.tpsLimiter();
}
} }