From b380338244ef425549e19318f2cde3a8afd96e8b Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 11 Sep 2018 17:38:57 -0400 Subject: [PATCH] Ensure entity is always dying before Death Event Prior to this it was possible for plugins to put the server into a never ending recursive loop until it eventually killed itself. Fixes GH-1432 --- .gitignore | 1 + .../0356-Improve-death-events.patch | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 9712169ad..3ef869c1a 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ work/Spigot-Server work/Spigot-API work/*.jar work/test-server +work/ForgeFlower # Mac filesystem dust .DS_Store/ diff --git a/Spigot-Server-Patches/0356-Improve-death-events.patch b/Spigot-Server-Patches/0356-Improve-death-events.patch index 736c0785a..47ab426e8 100644 --- a/Spigot-Server-Patches/0356-Improve-death-events.patch +++ b/Spigot-Server-Patches/0356-Improve-death-events.patch @@ -1,4 +1,4 @@ -From b8c6e5d80cd3b21db5b3d9a031439d37143eb467 Mon Sep 17 00:00:00 2001 +From 61dddacb42c358d24f53ae3a28e5a49eca53d271 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Tue, 21 Aug 2018 01:39:35 +0100 Subject: [PATCH] Improve death events @@ -69,7 +69,7 @@ index dca497072..454c1e7d0 100644 } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 14637be49..dec4b442c 100644 +index 14637be49..5ccd3ea6f 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -75,14 +75,14 @@ public abstract class EntityLiving extends Entity { @@ -140,7 +140,7 @@ index 14637be49..dec4b442c 100644 - this.aU = true; - this.getCombatTracker().g(); -+ //this.aU = true; ++ this.aU = true; // Paper - Always set at start, unset later if cancelled - GH-1432 + //this.getCombatTracker().g(); + + org.bukkit.event.entity.EntityDeathEvent deathEvent = null; @@ -148,7 +148,7 @@ index 14637be49..dec4b442c 100644 if (!this.world.isClientSide) { int i = 0; -@@ -1136,15 +1145,32 @@ public abstract class EntityLiving extends Entity { +@@ -1136,15 +1145,33 @@ public abstract class EntityLiving extends Entity { this.a(flag, i, damagesource); // CraftBukkit start - Call death event @@ -178,13 +178,14 @@ index 14637be49..dec4b442c 100644 + this.setDying(true); + this.world.broadcastEntityEffect(this, (byte) 3); + } else { ++ this.setDying(false); // Paper - reset if cancelled + this.setHealth((float) deathEvent.getReviveHealth()); + } + // Paper end } } -@@ -1198,6 +1224,7 @@ public abstract class EntityLiving extends Entity { +@@ -1198,6 +1225,7 @@ public abstract class EntityLiving extends Entity { return SoundEffects.bX; } @@ -192,7 +193,7 @@ index 14637be49..dec4b442c 100644 @Nullable protected SoundEffect cf() { return SoundEffects.bS; -@@ -1583,10 +1610,12 @@ public abstract class EntityLiving extends Entity { +@@ -1583,10 +1611,12 @@ public abstract class EntityLiving extends Entity { } @@ -412,5 +413,5 @@ index cce4acc0b..f1a3ca950 100644 * Server methods */ -- -2.18.0.windows.1 +2.19.0