Paper/Spigot-API-Patches/0038-EntityRegainHealthEvent-isFastRegen-API.patch
2016-04-26 23:04:20 -04:00

51 lines
1.9 KiB
Diff

From 986cb0451c93c28f6428f4f3f64e23fe5d5be998 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Fri, 22 Apr 2016 01:43:11 -0500
Subject: [PATCH] EntityRegainHealthEvent isFastRegen API
diff --git a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
index a7b3517..703520f 100644
--- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
@@ -13,6 +13,7 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
private boolean cancelled;
private double amount;
private final RegainReason regainReason;
+ private final boolean isFastRegen; // Paper
@Deprecated
public EntityRegainHealthEvent(final Entity entity, final int amount, final RegainReason regainReason) {
@@ -20,10 +21,28 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
}
public EntityRegainHealthEvent(final Entity entity, final double amount, final RegainReason regainReason) {
+ // Paper start - Forward
+ this(entity, amount, regainReason, false);
+ }
+
+ public EntityRegainHealthEvent(final Entity entity, final double amount, final RegainReason regainReason, boolean isFastRegen) {
+ // Paper end
super(entity);
this.amount = amount;
this.regainReason = regainReason;
+ this.isFastRegen = isFastRegen; // Paper
+ }
+
+ // Paper start - Add getter for isFastRegen
+ /**
+ * Is this event a result of the fast regeneration mechanic
+ *
+ * @return Whether the event is the result of a fast regeneration mechanic
+ */
+ public boolean isFastRegen() {
+ return isFastRegen;
}
+ // Paper end
/**
* Gets the amount of regained health
--
2.5.0