49 lines
1.2 KiB
Java
49 lines
1.2 KiB
Java
package org.bukkit.event.player;
|
|
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.event.Cancellable;
|
|
|
|
/**
|
|
* This event is fired when the player is almost about to enter the bed.
|
|
*/
|
|
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable {
|
|
|
|
private boolean cancel = false;
|
|
private Block bed;
|
|
|
|
public PlayerBedEnterEvent(Player who, Block bed) {
|
|
super(Type.PLAYER_BED_ENTER, who);
|
|
this.bed = bed;
|
|
}
|
|
|
|
/**
|
|
* Gets the cancellation state of this event. A cancelled event will not
|
|
* be executed in the server, but will still pass to other plugins
|
|
*
|
|
* @return true if this event is cancelled
|
|
*/
|
|
public boolean isCancelled() {
|
|
return cancel;
|
|
}
|
|
|
|
/**
|
|
* Sets the cancellation state of this event. A cancelled event will not
|
|
* be executed in the server, but will still pass to other plugins
|
|
*
|
|
* @param cancel true if you wish to cancel this event
|
|
*/
|
|
public void setCancelled(boolean cancel) {
|
|
this.cancel = cancel;
|
|
}
|
|
|
|
/**
|
|
* Returns the bed block involved in this event.
|
|
*
|
|
* @return the bed block involved in this event
|
|
*/
|
|
public Block getBed() {
|
|
return bed;
|
|
}
|
|
}
|