CavePVP-Stuff/cSpigot-master/spigot-server-Patches/0152-Call-PlayerHealthChangeEvent.patch

26 lines
904 B
Diff
Raw Normal View History

2023-05-01 20:59:40 +02:00
From 88c6b70c9a26318d1045aa774aa00b57d866df37 Mon Sep 17 00:00:00 2001
From: Francisco Saldanha <francisco.gsaldanha@gmail.com>
Date: Thu, 13 Apr 2017 18:30:13 -0300
Subject: [PATCH] Call PlayerHealthChangeEvent
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 9541bd2c3..a32bedb59 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1308,7 +1308,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void setRealHealth(double health) {
+ double previous = this.health;
+
this.health = health;
+
+ Bukkit.getPluginManager().callEvent(new PlayerHealthChangeEvent(this, previous, health));
}
public void updateScaledHealth() {
--
2.13.3