Class 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.
    • Method Detail

      • getBedEnterResult

        @NotNull
        public PlayerBedEnterEvent.BedEnterResult getBedEnterResult()
        This describes the default outcome of this event.
        Returns:
        the bed enter result representing the default outcome of this event
      • 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() 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.

        Specified by:
        isCancelled in interface Cancellable
        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:
        setCancelled in interface Cancellable
        Parameters:
        cancel - true if you wish to cancel this event
      • getBed

        @NotNull
        public Block getBed()
        Returns the bed block involved in this event.
        Returns:
        the bed block involved in this event
      • getHandlerList

        @NotNull
        public static HandlerList getHandlerList()