aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0036-EntityRegainHealthEvent-isFastRegen-API.patch
blob: 685f10efdaf426a136ddc48586b1d0c4ee8eee1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From 7d6cfc99f472097c25b7b7a2ea575724d7edaa5c 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 c7e9ba6f..3ffc7273 100644
--- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
@@ -13,12 +13,31 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable
     private boolean cancelled;
     private double amount;
     private final RegainReason regainReason;
+    private final boolean isFastRegen; // Paper
 
     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.12.2