Cancellable
public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable
Modifier and Type | Class | Description |
---|---|---|
static class |
PlayerBedEnterEvent.BedEnterResult |
Represents the default possible outcomes of this event.
|
Event.Result
player
Constructor | Description |
---|---|
PlayerBedEnterEvent(Player who,
Block bed) |
Deprecated.
|
PlayerBedEnterEvent(Player who,
Block bed,
PlayerBedEnterEvent.BedEnterResult bedEnterResult) |
Modifier and Type | Method | Description |
---|---|---|
Block |
getBed() |
Returns the bed block involved in this event.
|
PlayerBedEnterEvent.BedEnterResult |
getBedEnterResult() |
This describes the default outcome of this event.
|
static HandlerList |
getHandlerList() |
|
HandlerList |
getHandlers() |
|
boolean |
isCancelled() |
Gets the cancellation state of this event.
|
void |
setCancelled(boolean cancel) |
Sets the cancellation state of this event.
|
void |
setUseBed(Event.Result useBed) |
Sets the action to take with the interacted bed.
|
Event.Result |
useBed() |
This controls the action to take with the bed that was clicked on.
|
getEventName, isAsynchronous
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPlayer
public PlayerBedEnterEvent(@NotNull Player who, @NotNull Block bed, @NotNull PlayerBedEnterEvent.BedEnterResult bedEnterResult)
@Deprecated public PlayerBedEnterEvent(@NotNull Player who, @NotNull Block bed)
@NotNull public PlayerBedEnterEvent.BedEnterResult getBedEnterResult()
@NotNull public 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 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 Block getBed()
@NotNull public HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static HandlerList getHandlerList()
Copyright © 2020. All rights reserved.