Paper/Spigot-Server-Patches/0086-Set-health-before-death-event.patch

50 Zeilen
2.0 KiB
Diff

From 3d192ba83e69c17fb5d9b21a9e30b0f1c72a4076 Mon Sep 17 00:00:00 2001
2016-03-19 18:12:30 +01:00
From: Jedediah Smith <jedediah@silencegreys.com>
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 2e17397..f0f8cb2 100644
2016-03-19 18:12:30 +01:00
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -208,4 +208,9 @@ public class PaperConfig {
2016-03-19 18:12:30 +01:00
private static void loadPermsBeforePlugins() {
loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
}
+
+ public static boolean setHealthBeforeDeathEvent = false;
+ private static void healthDeath() {
2016-03-19 18:12:30 +01:00
+ 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 79d60a6..b807a3f 100644
2016-03-19 18:12:30 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2016-07-31 01:02:34 +02:00
@@ -98,11 +98,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2016-03-19 18:12:30 +01:00
+ (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
}
+ // Paper start
+ if (com.destroystokyo.paper.PaperConfig.setHealthBeforeDeathEvent) {
+ this.getHandle().setHealth((float) health);
+ }
2016-07-31 01:02:34 +02:00
+
if (health == 0) {
getHandle().die(DamageSource.GENERIC);
2016-03-19 18:12:30 +01:00
}
- getHandle().setHealth((float) health);
+ // Paper start - wrap, see above
+ if (!com.destroystokyo.paper.PaperConfig.setHealthBeforeDeathEvent) {
+ getHandle().setHealth((float) health);
+ }
+ // Paper end
}
public double getMaxHealth() {
--
2016-07-31 01:02:34 +02:00
2.9.2.windows.1
2016-03-19 18:12:30 +01:00