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
This event is fired when the player is almost about to enter the bed.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumRepresents the default possible outcomes of this event.Nested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Field SummaryFields inherited from class org.bukkit.event.player.PlayerEventplayer
- 
Constructor SummaryConstructorsConstructorDescriptionPlayerBedEnterEvent(@NotNull Player player, @NotNull Block bed) Deprecated, for removal: This API element is subject to removal in a future version.PlayerBedEnterEvent(@NotNull Player player, @NotNull Block bed, @NotNull PlayerBedEnterEvent.BedEnterResult bedEnterResult) 
- 
Method SummaryModifier and TypeMethodDescriptiongetBed()Returns the bed block involved in this event.This describes the default outcome of this event.static @NotNull HandlerListbooleanGets the cancellation state of this event.voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetUseBed(@NotNull Event.Result useBed) Sets the action to take with the interacted bed.useBed()This controls the action to take with the bed that was clicked on.Methods inherited from class org.bukkit.event.player.PlayerEventgetPlayerMethods inherited from class org.bukkit.event.EventcallEvent, getEventName, isAsynchronous
- 
Constructor Details- 
PlayerBedEnterEvent
- 
PlayerBedEnterEvent@Internal @Deprecated(since="1.13.2", forRemoval=true) public PlayerBedEnterEvent(@NotNull @NotNull Player player, @NotNull @NotNull Block bed) Deprecated, for removal: This API element is subject to removal in a future version.
 
- 
- 
Method Details- 
getBedReturns the bed block involved in this event.- Returns:
- the bed block involved in this event
 
- 
getBedEnterResultThis describes the default outcome of this event.- Returns:
- the bed enter result representing the default outcome of this event
 
- 
useBedThis 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:
 
- 
setUseBedSets 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:
 
- 
isCancelledpublic boolean isCancelled()Gets the cancellation state of this event. Set totrueif 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 trueifuseBed()isEvent.Result.DEFAULTand thedefault actionis to prevent bed entering.- Specified by:
- isCancelledin interface- Cancellable
- Returns:
- boolean cancellation state
 
- 
setCancelledpublic void setCancelled(boolean 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.Canceling this event will prevent use of the bed. - Specified by:
- setCancelledin interface- Cancellable
- Parameters:
- cancel-- trueif you wish to cancel this event
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-