2015-02-28 11:36:22 +00:00
|
|
|
From 3adf7c50ac25727434bd3aea045dcad4b4ec8cf5 Mon Sep 17 00:00:00 2001
|
2014-08-24 07:40:45 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 20 Aug 2014 18:12:32 -0400
|
|
|
|
Subject: [PATCH] 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.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2015-02-28 11:36:22 +00:00
|
|
|
index 10f6e47..2d22327 100644
|
2014-08-24 07:40:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2014-11-28 01:17:45 +00:00
|
|
|
@@ -41,6 +41,7 @@ public class EntityTNTPrimed extends Entity {
|
2014-08-24 07:40:45 +00:00
|
|
|
}
|
|
|
|
|
2015-02-28 11:36:22 +00:00
|
|
|
public void t_() {
|
2014-08-24 07:40:45 +00:00
|
|
|
+ if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
|
|
|
this.lastX = this.locX;
|
|
|
|
this.lastY = this.locY;
|
|
|
|
this.lastZ = this.locZ;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
2015-02-28 11:36:22 +00:00
|
|
|
index 18b7f7d..c820ee0 100644
|
2014-08-24 07:40:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2015-02-28 11:36:22 +00:00
|
|
|
@@ -581,6 +581,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
2014-08-24 07:40:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
super.tickEntities();
|
|
|
|
+ spigotConfig.currentPrimedTnt = 0; // Spigot
|
|
|
|
}
|
|
|
|
|
2014-11-28 01:17:45 +00:00
|
|
|
public void j() {
|
2014-08-24 07:40:45 +00:00
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2015-02-28 11:36:22 +00:00
|
|
|
index 75edbb9..3b6d4c0 100644
|
2014-08-24 07:40:45 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2015-02-28 11:36:22 +00:00
|
|
|
@@ -313,4 +313,15 @@ public class SpigotWorldConfig
|
2014-08-24 07:40:45 +00:00
|
|
|
combatExhaustion = (float) getDouble( "hunger.combat-exhaustion", 0.3 );
|
|
|
|
regenExhaustion = (float) getDouble( "hunger.regen-exhaustion", 3 );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public int currentPrimedTnt = 0;
|
|
|
|
+ public int maxTntTicksPerTick;
|
|
|
|
+ private void maxTntPerTick() {
|
|
|
|
+ if ( SpigotConfig.version < 7 )
|
|
|
|
+ {
|
|
|
|
+ set( "max-tnt-per-tick", 100 );
|
|
|
|
+ }
|
|
|
|
+ maxTntTicksPerTick = getInt( "max-tnt-per-tick", 100 );
|
|
|
|
+ log( "Max TNT Explosions: " + maxTntTicksPerTick );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2014-11-28 01:17:45 +00:00
|
|
|
2.1.0
|
2014-08-24 07:40:45 +00:00
|
|
|
|