mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
19972e09b8
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch 068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
55 lines
2.2 KiB
Diff
55 lines
2.2 KiB
Diff
From 39f6dc45ba2b718f82c064cf4dd344c0e7155cfa Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 98c8d26..3621faf 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
@@ -41,6 +41,7 @@ public class EntityTNTPrimed extends Entity {
|
|
}
|
|
|
|
public void s_() {
|
|
+ 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
|
|
index 508e4ce..ff9ac1b 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -575,6 +575,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
|
}
|
|
|
|
super.tickEntities();
|
|
+ spigotConfig.currentPrimedTnt = 0; // Spigot
|
|
}
|
|
|
|
public void j() {
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index 3f145b3..46377ab 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -338,4 +338,15 @@ public class SpigotWorldConfig
|
|
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 );
|
|
+ }
|
|
}
|
|
--
|
|
2.1.0
|
|
|