diff options
author | EvilSeph <evilseph@unaligned.org> | 2011-06-28 20:10:50 -0400 |
---|---|---|
committer | EvilSeph <evilseph@unaligned.org> | 2011-06-30 14:43:00 -0400 |
commit | 212849fc2152c986a326fc0eacf235369cc8342f (patch) | |
tree | 1bf0fa581e7de91be3f02e697e6f22e3895d397e | |
parent | 542376d7b3bafccb811e28c2bf324ad8abb37211 (diff) | |
download | bukkit-212849fc2152c986a326fc0eacf235369cc8342f.tar bukkit-212849fc2152c986a326fc0eacf235369cc8342f.tar.gz bukkit-212849fc2152c986a326fc0eacf235369cc8342f.tar.lz bukkit-212849fc2152c986a326fc0eacf235369cc8342f.tar.xz bukkit-212849fc2152c986a326fc0eacf235369cc8342f.zip |
Added reasons for entities regaining health.
-rw-r--r-- | src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java index f886727b..c8b7a4e5 100644 --- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java @@ -11,15 +11,12 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable private boolean cancelled; private int amount; + private RegainReason regainReason; - public EntityRegainHealthEvent(Entity entity, int amount) { + public EntityRegainHealthEvent(Entity entity, int amount, RegainReason regainReason) { super(Event.Type.ENTITY_REGAIN_HEALTH, entity); this.amount = amount; - } - - protected EntityRegainHealthEvent(Event.Type type, Entity entity, int amount) { - super(type, entity); - this.amount = amount; + this.regainReason = regainReason; } /** @@ -64,4 +61,32 @@ public class EntityRegainHealthEvent extends EntityEvent implements Cancellable public void setCancelled(boolean cancel) { cancelled = cancel; } + + /** + * Gets the reason for why the entity is regaining health + * + * @return A RegainReason detailing the reason for the entity regaining health + */ + public RegainReason getRegainReason() { + return regainReason; + } + + /** + * An enum to specify the type of health regaining + */ + public enum RegainReason { + + /** + * When a player regains health from regenerating due to Peaceful mode (spawn-monsters=false) + */ + REGEN, + /** + * When a player regains health from eating consumables + */ + EATING, + /** + * Any other reason not covered by the reasons above + */ + CUSTOM + } } |