Package org.bukkit.event.player
Class PlayerBedEnterEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerBedEnterEvent
- All Implemented Interfaces:
Cancellable
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable
This event is fired when the player is almost about to enter the bed.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPlayerBedEnterEvent.BedEnterResultRepresents the default possible outcomes of this event. -
Field Summary
-
Constructor Summary
Constructors Constructor Description PlayerBedEnterEvent(Player who, Block bed)Deprecated.PlayerBedEnterEvent(Player who, Block bed, PlayerBedEnterEvent.BedEnterResult bedEnterResult) -
Method Summary
Modifier and Type Method Description BlockgetBed()Returns the bed block involved in this event.PlayerBedEnterEvent.BedEnterResultgetBedEnterResult()This describes the default outcome of this event.static HandlerListgetHandlerList()HandlerListgetHandlers()booleanisCancelled()Gets the cancellation state of this event.voidsetCancelled(boolean cancel)Sets the cancellation state of this event.voidsetUseBed(Event.Result useBed)Sets the action to take with the interacted bed.Event.ResultuseBed()This controls the action to take with the bed that was clicked on.
-
Constructor Details
-
PlayerBedEnterEvent
-
PlayerBedEnterEvent
Deprecated.
-
-
Method Details
-
getBedEnterResult
This describes the default outcome of this event.- Returns:
- the bed enter result representing the default outcome of this event
-
useBed
This controls the action to take with the bed that was clicked on.In case of
Event.Result.DEFAULT, the default outcome is described bygetBedEnterResult().- Returns:
- the action to take with the interacted bed
- See Also:
setUseBed(org.bukkit.event.Event.Result)
-
setUseBed
Sets the action to take with the interacted bed.Event.Result.ALLOWwill result in the player sleeping, regardless of the default outcome described bygetBedEnterResult().
Event.Result.DENYwill prevent the player from sleeping. This has the same effect as canceling the event viasetCancelled(boolean).
Event.Result.DEFAULTwill result in the outcome described bygetBedEnterResult().- Parameters:
useBed- the action to take with the interacted bed- See Also:
useBed()
-
isCancelled
public boolean isCancelled()Gets the cancellation state of this event. Set to true if you want to prevent the player from sleeping.Canceling the event has the same effect as setting
useBed()toEvent.Result.DENY.For backwards compatibility reasons this also returns true if
useBed()isEvent.Result.DEFAULTand thedefault actionis to prevent bed entering.- Specified by:
isCancelledin interfaceCancellable- Returns:
- boolean cancellation state
-
setCancelled
public void setCancelled(boolean cancel)Sets the cancellation state of this event. A canceled event will not be executed in the server, but will still pass to other plugins.Canceling this event will prevent use of the bed.
- Specified by:
setCancelledin interfaceCancellable- Parameters:
cancel- true if you wish to cancel this event
-
getBed
Returns the bed block involved in this event.- Returns:
- the bed block involved in this event
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-