Class endstone::PlayerBedEnterEvent¶
ClassList > endstone > PlayerBedEnterEvent
Called when a player is almost about to enter the bed.
#include <endstone/event/player/player_bed_enter_event.h>
Inherits the following classes: endstone::Cancellable
Public Functions¶
| Type | Name |
|---|---|
| PlayerBedEnterEvent (Player & player, Block & bed) |
|
| Block & | getBed () const Represents the default possible outcomes of this event. |
Public Functions inherited from endstone::Cancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () Cancel this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
| virtual bool | isCancelled () override const Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
| virtual void | setCancelled (bool cancel) override Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins. |
Public Functions inherited from endstone::ICancellable¶
| Type | Name |
|---|---|
| virtual void | cancel () = 0 |
| virtual bool | isCancelled () const = 0 |
| virtual void | setCancelled (bool cancel) = 0 |
| virtual | ~ICancellable () = default |
Public Functions Documentation¶
function PlayerBedEnterEvent¶
function getBed¶
Represents the default possible outcomes of this event.
The player will enter the bed. The dimension doesn't allow sleeping or saving the spawn point (eg,Nether, The End). Entering the bed is prevented due to it not being night nor thundering currently. Entering the bed is prevented due to the player being too far away. Entering the bed is prevented due to there being monsters nearby. Entering the bed is prevented due to there being some other problem.
This describes the default outcome of this event.
Returns:
The bed enter result representing the default outcome of this event
This controls the action to take with the bed that was clicked on.
Returns:
the action to take with the interacted bed
Sets the action to take with the interacted bed.
- Result::Allow will result in the player sleeping, regardless of the default outcome described by getBedEnterResult().
- Result::Deny will prevent the player from sleeping. This has the same effect as canceling the event
- Result::Default will result in the outcome described by getBedEnterResult().
Parameters:
use_bedthe action to take with the interacted bed
Gets the cancellation state of this event. Set to true if you want to prevent the player from sleeping.
Note:
Canceling the event has the same effect as setting useBed() to Result::Deny.
Returns:
boolean cancellation state will still pass to other plugins.
Note:
Canceling this event will prevent use of the bed.
Parameters:
canceltrue if you wish to cancel this event
Returns the bed block involved in this event.
Returns:
The bed block involved in this event.
The documentation for this class was generated from the following file include/endstone/event/player/player_bed_enter_event.h