From 0a9d183bd4d2fe129bfec8d9a83033ff2d051647 Mon Sep 17 00:00:00 2001 From: Riley Park Date: Sat, 19 Mar 2016 10:12:30 -0700 Subject: [PATCH] Set health before death event --- .../Set-health-before-death-event.patch | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Spigot-Server-Patches/Set-health-before-death-event.patch diff --git a/Spigot-Server-Patches/Set-health-before-death-event.patch b/Spigot-Server-Patches/Set-health-before-death-event.patch new file mode 100644 index 0000000000..92536bf7b1 --- /dev/null +++ b/Spigot-Server-Patches/Set-health-before-death-event.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jedediah Smith +Date: Sun, 19 Jul 2015 16:51:38 -0400 +Subject: [PATCH] Set health before death event + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ public class PaperConfig { + private static void loadPermsBeforePlugins() { + loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true); + } ++ ++ public static boolean setHealthBeforeDeathEvent = false; ++ public static void healthDeath() { ++ setHealthBeforeDeathEvent = getBoolean("settings.set-health-before-death-event", false); ++ } + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')')); + } + ++ // Paper start ++ if (com.destroystokyo.paper.PaperConfig.setHealthBeforeDeathEvent) { ++ this.getHandle().setHealth((float) health); ++ } ++ // Paper end ++ + if (entity instanceof EntityPlayer && health == 0) { + ((EntityPlayer) entity).die(DamageSource.GENERIC); + } + +- getHandle().setHealth((float) health); ++ // Paper start - wrap, see above ++ if (!com.destroystokyo.paper.PaperConfig.setHealthBeforeDeathEvent) { ++ getHandle().setHealth((float) health); ++ } ++ // Paper end + } + + public double getMaxHealth() { +-- \ No newline at end of file