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:
Commit
ae8521b85e
@ -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;
|
||||||
|
|
||||||
|
@ -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,13 @@ 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);
|
||||||
|
if (instance != null) {
|
||||||
|
currentTPSLimit = d;
|
||||||
|
instance.tpsLimiter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren