public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable
Modifier and Type | Class and Description |
---|---|
static class |
PlayerBedEnterEvent.BedEnterResult
Represents the default possible outcomes of this event.
|
Event.Result
player
Constructor and Description |
---|
PlayerBedEnterEvent(@NotNull Player who,
@NotNull Block bed)
Deprecated.
|
PlayerBedEnterEvent(@NotNull Player who,
@NotNull Block bed,
@NotNull PlayerBedEnterEvent.BedEnterResult bedEnterResult) |
Modifier and Type | Method and Description |
---|---|
@NotNull Block |
getBed()
Returns the bed block involved in this event.
|
@NotNull PlayerBedEnterEvent.BedEnterResult |
getBedEnterResult()
This describes the default outcome of this event.
|
static @NotNull HandlerList |
getHandlerList() |
@NotNull HandlerList |
getHandlers() |
boolean |
isCancelled()
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event.
|
void |
setUseBed(@NotNull Event.Result useBed)
Sets the action to take with the interacted bed.
|
@NotNull Event.Result |
useBed()
This controls the action to take with the bed that was clicked on.
|
getPlayer
callEvent, getEventName, isAsynchronous
public PlayerBedEnterEvent(@NotNull @NotNull Player who, @NotNull @NotNull Block bed, @NotNull @NotNull PlayerBedEnterEvent.BedEnterResult bedEnterResult)
@NotNull public @NotNull PlayerBedEnterEvent.BedEnterResult getBedEnterResult()
@NotNull public @NotNull Event.Result useBed()
In case of Event.Result.DEFAULT
, the default outcome is described by
getBedEnterResult()
.
setUseBed(org.bukkit.event.Event.Result)
public void setUseBed(@NotNull @NotNull Event.Result useBed)
Event.Result.ALLOW
will result in the player sleeping, regardless of
the default outcome described by getBedEnterResult()
.
Event.Result.DENY
will prevent the player from sleeping. This has the
same effect as canceling the event via setCancelled(boolean)
.
Event.Result.DEFAULT
will result in the outcome described by
getBedEnterResult()
.
useBed
- the action to take with the interacted beduseBed()
public boolean isCancelled()
Canceling the event has the same effect as setting useBed()
to
Event.Result.DENY
.
For backwards compatibility reasons this also returns true if
useBed()
is Event.Result.DEFAULT
and the
default action
is to prevent bed entering.
isCancelled
in interface Cancellable
public void setCancelled(boolean cancel)
Canceling this event will prevent use of the bed.
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this event@NotNull public @NotNull Block getBed()
@NotNull public @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2021. All rights reserved.