testserver/Spigot-Server-Patches/0026-Configurable-nerf-for-...

50 lines
1.9 KiB
Diff

From 221e27c07fcc4d17bc05bf571712c303cd911f6e Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Wed, 9 Jul 2014 17:38:48 -0500
Subject: [PATCH] Configurable nerf for TNT cannons
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 8ca4300..3be3d98 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+import org.github.paperspigot.PaperSpigotWorldConfig;
public class EntityTNTPrimed extends Entity {
@@ -56,6 +57,12 @@ public class EntityTNTPrimed extends Entity {
this.motY *= -0.5D;
}
+ // PaperSpigot start - Configurable nerf for TNT cannons
+ if (this.locY > PaperSpigotWorldConfig.tntHeightNerf && PaperSpigotWorldConfig.tntHeightNerf != 0) {
+ this.die();
+ }
+ // PaperSpigot end
+
if (this.fuseTicks-- <= 0) {
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
if (!this.world.isStatic) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 39bbd62..0d388af 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -169,4 +169,10 @@ public class PaperSpigotWorldConfig
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
}
+
+ public static double tntHeightNerf;
+ private void tntHeightNerf()
+ {
+ tntHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
+ }
}
--
1.9.1