2016-04-02 02:08:40 +00:00
|
|
|
From 8c29971e2b222a7cbe7d0d9d48a99cc0fa129b58 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
|
2016-03-25 06:46:53 +00:00
|
|
|
index 2db9fc0..5a9e032 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
|
2016-03-25 06:46:53 +00:00
|
|
|
@@ -180,4 +180,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;
|
|
|
|
+ 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
|
2016-03-29 01:01:42 +00:00
|
|
|
index 0502593..3a0d338 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
|
|
|
|
@@ -98,11 +98,21 @@ 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() {
|
|
|
|
--
|
2016-03-31 00:50:23 +00:00
|
|
|
2.8.0
|
2016-03-19 17:12:30 +00:00
|
|
|
|