2017-03-25 05:22:02 +00:00
|
|
|
From 62f9ecf769955dd17317af05db2280aa386940e0 Mon Sep 17 00:00:00 2001
|
2016-03-19 17:12:30 +00: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
|
2017-03-25 05:22:02 +00:00
|
|
|
index 078e0d989..a48f5cb51 100644
|
2016-03-19 17:12:30 +00:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
2017-03-25 05:22:02 +00:00
|
|
|
@@ -214,4 +214,9 @@ public class PaperConfig {
|
2016-03-19 17:12:30 +00:00
|
|
|
private static void loadPermsBeforePlugins() {
|
|
|
|
loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean setHealthBeforeDeathEvent = false;
|
2016-06-04 22:26:11 +00:00
|
|
|
+ private static void healthDeath() {
|
2016-03-19 17:12:30 +00: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
|
2017-03-25 03:18:58 +00:00
|
|
|
index 348a8c758..c0103cb39 100644
|
2016-03-19 17:12:30 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2017-02-02 04:48:16 +00:00
|
|
|
@@ -102,11 +102,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2016-03-19 17:12:30 +00:00
|
|
|
+ (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')'));
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ if (com.destroystokyo.paper.PaperConfig.setHealthBeforeDeathEvent) {
|
|
|
|
+ this.getHandle().setHealth((float) health);
|
|
|
|
+ }
|
2016-07-30 23:02:34 +00:00
|
|
|
+
|
|
|
|
if (health == 0) {
|
|
|
|
getHandle().die(DamageSource.GENERIC);
|
2016-03-19 17:12:30 +00: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() {
|
|
|
|
--
|
2017-03-25 03:18:58 +00:00
|
|
|
2.12.0.windows.1
|
2016-03-19 17:12:30 +00:00
|
|
|
|