程序包 org.bukkit.event.player

# 类 PlayerBedEnterEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
org.bukkit.event.player.PlayerBedEnterEvent

所有已实现的接口:
  `Cancellable`

public class PlayerBedEnterEvent extends PlayerEvent implements Cancellable
玩家准备躺到床上时触发此事件.

- ## 嵌套类概要

  嵌套类
  修饰符和类型
  类
  说明
  `static enum`
  `PlayerBedEnterEvent.BedEnterResult`
  Represents the default possible outcomes of this event.

  ## 从类继承的嵌套类/接口 org.bukkit.event.Event

  `Event.Result`

- ## 字段概要

  ### 从类继承的字段 org.bukkit.event.player.PlayerEvent

  `player`

- ## 构造器概要

  构造器
  构造器
  说明
  `PlayerBedEnterEvent(@NotNull Player who, @NotNull Block bed)`
  已过时。
  `PlayerBedEnterEvent(@NotNull Player who, @NotNull Block bed, @NotNull PlayerBedEnterEvent.BedEnterResult bedEnterResult)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `@NotNull Block`
  `getBed()`
  返回此事件涉及的床.
  `@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.

  ### 从类继承的方法 org.bukkit.event.player.PlayerEvent

  `getPlayer`

  ### 从类继承的方法 org.bukkit.event.Event

  `getEventName, isAsynchronous`

  ### 从类继承的方法 java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 构造器详细资料

  - ### PlayerBedEnterEvent

    public PlayerBedEnterEvent(@NotNull @NotNull Player who, @NotNull @NotNull Block bed, @NotNull @NotNull PlayerBedEnterEvent.BedEnterResult bedEnterResult)

  - ### PlayerBedEnterEvent

    @Deprecated public PlayerBedEnterEvent(@NotNull @NotNull Player who, @NotNull @NotNull Block bed)
    已过时。

- ## 方法详细资料

  - ### getBedEnterResult

    @NotNull public @NotNull PlayerBedEnterEvent.BedEnterResult getBedEnterResult()
    This describes the default outcome of this event.
    返回:
      the bed enter result representing the default outcome of this event

  - ### useBed

    @NotNull public @NotNull Event.Result useBed()
    This controls the action to take with the bed that was clicked on.

    In case of `Event.Result.DEFAULT`, the default outcome is described by `getBedEnterResult()`.

    返回:
      the action to take with the interacted bed
    另请参阅:
      - `setUseBed(org.bukkit.event.Event.Result)`

  - ### setUseBed

    public void setUseBed(@NotNull @NotNull Event.Result useBed)
    Sets the action to take with the interacted bed.

    `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 bed
    另请参阅:
      - `useBed()`

  - ### 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.

    指定者:
      `isCancelled` 在接口中 `Cancellable`
    返回:
      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.

    指定者:
      `setCancelled` 在接口中 `Cancellable`
    参数:
      `cancel` - true if you wish to cancel this event

  - ### getBed

    @NotNull public @NotNull Block getBed()
    返回此事件涉及的床.

    原文:Returns the bed block involved in this event.

    返回:
      床

  - ### getHandlers

    @NotNull public @NotNull HandlerList getHandlers()
    指定者:
      `getHandlers` 在类中 `Event`

  - ### getHandlerList

    @NotNull public static @NotNull HandlerList getHandlerList()