diff options
author | Parker Hawke <hawkeboyz2@hotmail.com> | 2018-09-16 12:56:34 -0400 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-09-17 16:46:37 +1000 |
commit | 4b9a93eccfefb73860fbbf6e6ea072676e26ef92 (patch) | |
tree | 02e24d7fcb249d8c063fbcd9611bdc7a3bd0ee67 /src/main/java/org | |
parent | 47b9cf30ac5f6e61c84c126075932c4b9d123d95 (diff) | |
download | bukkit-4b9a93eccfefb73860fbbf6e6ea072676e26ef92.tar bukkit-4b9a93eccfefb73860fbbf6e6ea072676e26ef92.tar.gz bukkit-4b9a93eccfefb73860fbbf6e6ea072676e26ef92.tar.lz bukkit-4b9a93eccfefb73860fbbf6e6ea072676e26ef92.tar.xz bukkit-4b9a93eccfefb73860fbbf6e6ea072676e26ef92.zip |
Add BatToggleSleepEvent
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/event/entity/BatToggleSleepEvent.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/event/entity/BatToggleSleepEvent.java b/src/main/java/org/bukkit/event/entity/BatToggleSleepEvent.java new file mode 100644 index 00000000..9da222c7 --- /dev/null +++ b/src/main/java/org/bukkit/event/entity/BatToggleSleepEvent.java @@ -0,0 +1,52 @@ +package org.bukkit.event.entity; + +import org.bukkit.entity.Bat; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; + +/** + * Called when a bat attempts to sleep or wake up from its slumber. + * <p> + * If a Bat Toggle Sleep event is cancelled, the Bat will not toggle its sleep + * state. + */ +public class BatToggleSleepEvent extends EntityEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); + + private boolean cancel = false; + private final boolean awake; + + public BatToggleSleepEvent(Bat what, boolean awake) { + super(what); + this.awake = awake; + } + + /** + * Get whether or not the bat is attempting to awaken. + * + * @return true if trying to awaken, false otherwise + */ + public boolean isAwake() { + return awake; + } + + @Override + public void setCancelled(boolean cancel) { + this.cancel = cancel; + } + + @Override + public boolean isCancelled() { + return cancel; + } + + @Override + public HandlerList getHandlers() { + return handlers; + } + + public static HandlerList getHandlerList() { + return handlers; + } +} |