Setting for disabling the physics limiter

This commit is contained in:
Jesse Boyd 2016-09-26 14:05:58 +10:00
parent 9e6c90430d
commit 50504a0fe5
2 changed files with 14 additions and 10 deletions

View File

@ -13,16 +13,18 @@ import org.bukkit.event.entity.ItemSpawnEvent;
public class ChunkListener implements Listener {
public ChunkListener() {
Bukkit.getPluginManager().registerEvents(ChunkListener.this, Fawe.<FaweBukkit>imp().getPlugin());
TaskManager.IMP.repeat(new Runnable() {
@Override
public void run() {
physicsFreeze = false;
itemFreeze = false;
physicsLimit = Settings.TICK_LIMITER.PHYSICS;
itemLimit = Settings.TICK_LIMITER.ITEMS;
}
}, 1);
if (Settings.TICK_LIMITER.ENABLED) {
Bukkit.getPluginManager().registerEvents(ChunkListener.this, Fawe.<FaweBukkit>imp().getPlugin());
TaskManager.IMP.repeat(new Runnable() {
@Override
public void run() {
physicsFreeze = false;
itemFreeze = false;
physicsLimit = Settings.TICK_LIMITER.PHYSICS;
itemLimit = Settings.TICK_LIMITER.ITEMS;
}
}, 1);
}
}
private int physicsLimit = Integer.MAX_VALUE;

View File

@ -230,6 +230,8 @@ public class Settings extends Config {
@Comment("Generic tick limiter (not necessarily WorldEdit related, but still useful)")
public static class TICK_LIMITER {
@Comment("Enable the limiter")
public static boolean ENABLED = true;
@Comment("Max physics per tick")
public static int PHYSICS = 500000;
@Comment("Max item spawns per tick")