SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Fix CommandTPSLimiter bug' (#223) from TPSStuffForAutoShutdown into master

Reviewed-on: #223
Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
YoyoNow 2021-04-03 18:26:46 +02:00
Commit ae8521b85e
2 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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;

Datei anzeigen

@ -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();
}
}
}