mSpigot-Parent/patches/api/0008-Add-PlayerHealthEvent.patch
2023-07-21 06:34:25 +03:00

54 lines
1.4 KiB
Diff

From e21c21692f6c955b90d2e8fecf136c0dd08ac24a Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
Date: Fri, 21 Jul 2023 05:55:55 +0300
Subject: [PATCH] Add PlayerHealthEvent
diff --git a/src/main/java/org/bukkit/event/player/PlayerHealthChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerHealthChangeEvent.java
new file mode 100644
index 00000000..bca20174
--- /dev/null
+++ b/src/main/java/org/bukkit/event/player/PlayerHealthChangeEvent.java
@@ -0,0 +1,37 @@
+package org.bukkit.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+
+public class PlayerHealthChangeEvent extends PlayerEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private final double previousHealth;
+ private final double newHealth;
+
+ public PlayerHealthChangeEvent(final Player player, final double previousHealth, final double newHealth) {
+ super(player);
+
+ this.previousHealth = previousHealth;
+ this.newHealth = newHealth;
+ }
+
+ public double getPreviousHealth() {
+ return previousHealth;
+ }
+
+ public double getNewHealth() {
+ return newHealth;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
\ No newline at end of file
--
2.41.0.windows.1