Limit TNT Detonations per tick

This gives a per-world control on how much TNT will be processed per-tick,
preventing a massive TNT detonation from lagging out the server.

By: Aikar <aikar@aikar.co>
This commit is contained in:
CraftBukkit/Spigot
2014-08-20 18:12:32 -04:00
parent c34736a0d2
commit d7f3ba3df3
3 changed files with 28 additions and 8 deletions

View File

@@ -21,7 +21,15 @@
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
super(type, world);
@@ -107,10 +114,13 @@
@@ -94,6 +101,7 @@
@Override
public void tick() {
+ if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
this.handlePortal();
this.applyGravity();
this.move(MoverType.SELF, this.getDeltaMovement());
@@ -107,10 +115,13 @@
this.setFuse(i);
if (i <= 0) {
@@ -36,7 +44,7 @@
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
@@ -121,7 +131,13 @@
@@ -121,7 +132,13 @@
}
private void explode() {