Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
c169c4a685
Pointed out by Andi in Spigot #53
56 Zeilen
2.2 KiB
Diff
56 Zeilen
2.2 KiB
Diff
From e9a46ef63c6712195a25c4d7eebb571759487cc1 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 e467aff..35ed2a6 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
@@ -45,6 +45,7 @@ public class EntityTNTPrimed extends Entity {
|
|
}
|
|
|
|
public void m() {
|
|
+ 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 b666996..46004f0 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -626,6 +626,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
|
|
|
this.worldProvider.r();
|
|
super.tickEntities();
|
|
+ spigotConfig.currentPrimedTnt = 0; // Spigot
|
|
}
|
|
|
|
protected void l() {
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
index 4cbcd14..a4d7ebb 100644
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
@@ -264,4 +264,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.5.0
|
|
|