mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
50 lines
2.0 KiB
Diff
50 lines
2.0 KiB
Diff
From 6c7006b595785c4b8b0435af3bd7055fcf019576 Mon Sep 17 00:00:00 2001
|
|
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 88b6778..a60aee6 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -200,4 +200,9 @@ public class PaperConfig {
|
|
private static void loadPermsBeforePlugins() {
|
|
loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true);
|
|
}
|
|
+
|
|
+ public static boolean setHealthBeforeDeathEvent = false;
|
|
+ private 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 2a77cd4..0493c1b 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -98,11 +98,20 @@ 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);
|
|
+ }
|
|
+
|
|
if (health == 0) {
|
|
getHandle().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() {
|
|
--
|
|
2.10.2
|
|
|