mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 03:22:19 +01:00
Add BatToggleSleepEvent
By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
parent
21030f1700
commit
de810e161a
1 changed files with 52 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue