程序包 org.bukkit.event.block

# 类 BlockPlaceEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockPlaceEvent

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

直接已知子类:
  `BlockMultiPlaceEvent`

public class BlockPlaceEvent extends BlockEvent implements Cancellable
当一个方块被玩家放置的时候触发此事件.

如果方块放置事件被取消，那么这个方块将不能被放置

- ## 嵌套类概要

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

  `Event.Result`

- ## 字段概要

  字段
  修饰符和类型
  字段
  说明
  `protected boolean`
  `canBuild`
  `protected boolean`
  `cancel`
  `protected EquipmentSlot`
  `hand`
  `protected ItemStack`
  `itemInHand`
  `protected Block`
  `placedAgainst`
  `protected Player`
  `player`
  `protected BlockState`
  `replacedBlockState`

  ### 从类继承的字段 org.bukkit.event.block.BlockEvent

  `block`

- ## 构造器概要

  构造器
  构造器
  说明
  `BlockPlaceEvent(@NotNull Block placedBlock, @NotNull BlockState replacedBlockState, @NotNull Block placedAgainst, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild)`
  已过时。
  `BlockPlaceEvent(@NotNull Block placedBlock, @NotNull BlockState replacedBlockState, @NotNull Block placedAgainst, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild, @NotNull EquipmentSlot hand)`

- ## 方法概要

  修饰符和类型
  方法
  说明
  `boolean`
  `canBuild()`
  获取这个方块是否可以建造.
  `@NotNull Block`
  `getBlockAgainst()`
  获取这个方块是依附在哪个方块上放置的.
  `@NotNull Block`
  `getBlockPlaced()`
  获得被放置的方块(还未真正被放置).
  `@NotNull BlockState`
  `getBlockReplacedState()`
  获取被替换的方块的 BlockState.
  `@NotNull EquipmentSlot`
  `getHand()`
  获取放置这个方块的手.
  `static @NotNull HandlerList`
  `getHandlerList()`
  `@NotNull HandlerList`
  `getHandlers()`
  `@NotNull ItemStack`
  `getItemInHand()`
  获取玩家放置的方块的物品形式(在玩家手上).
  `@NotNull Player`
  `getPlayer()`
  获得放置这个方块的玩家.
  `boolean`
  `isCancelled()`
  获取这个事件是否被取消.一个被取消的事件不会在服务器里执行，但是仍然会传递事件到其他插件.
  `void`
  `setBuild(boolean canBuild)`
  设置这个方块是否可以被放置.
  `void`
  `setCancelled(boolean cancel)`
  取消这个事件.

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

  `getBlock`

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

  `getEventName, isAsynchronous`

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

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

- ## 字段详细资料

  - ### cancel

    protected boolean cancel

  - ### canBuild

    protected boolean canBuild

  - ### placedAgainst

    protected Block placedAgainst

  - ### replacedBlockState

    protected BlockState replacedBlockState

  - ### itemInHand

    protected ItemStack itemInHand

  - ### player

    protected Player player

  - ### hand

    protected EquipmentSlot hand

- ## 构造器详细资料

  - ### BlockPlaceEvent

    @Deprecated public BlockPlaceEvent(@NotNull @NotNull Block placedBlock, @NotNull @NotNull BlockState replacedBlockState, @NotNull @NotNull Block placedAgainst, @NotNull @NotNull ItemStack itemInHand, @NotNull @NotNull Player thePlayer, boolean canBuild)
    已过时。

  - ### BlockPlaceEvent

    public BlockPlaceEvent(@NotNull @NotNull Block placedBlock, @NotNull @NotNull BlockState replacedBlockState, @NotNull @NotNull Block placedAgainst, @NotNull @NotNull ItemStack itemInHand, @NotNull @NotNull Player thePlayer, boolean canBuild, @NotNull @NotNull EquipmentSlot hand)

- ## 方法详细资料

  - ### isCancelled

    public boolean isCancelled()
    从接口复制的说明: `Cancellable`
    获取这个事件是否被取消.一个被取消的事件不会在服务器里执行，但是仍然会传递事件到其他插件.

    原文：Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins

    指定者:
      `isCancelled` 在接口中 `Cancellable`
    返回:
      如果事件已经被取消，则为true

  - ### setCancelled

    public void setCancelled(boolean cancel)
    从接口复制的说明: `Cancellable`
    取消这个事件. 一个被取消的事件不会在 服务器里执行，但是仍然会传递事件到其他插件.

    原文：Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

    指定者:
      `setCancelled` 在接口中 `Cancellable`
    参数:
      `cancel` - 如果你想取消这个事件，则为true

  - ### getPlayer

    @NotNull public @NotNull Player getPlayer()
    获得放置这个方块的玩家.

    原文:Gets the player who placed the block involved in this event.

    返回:
      放置这个方块的玩家

  - ### getBlockPlaced

    @NotNull public @NotNull Block getBlockPlaced()
    获得被放置的方块(还未真正被放置).

    原文:Clarity method for getting the placed block. Not really needed except for reasons of clarity.

    返回:
      被放置后的方块

  - ### getBlockReplacedState

    @NotNull public @NotNull BlockState getBlockReplacedState()
    获取被替换的方块的 BlockState. 通常被替换的方块是空气.

    原文:Gets the BlockState for the block which was replaced. Material type air mostly.

    返回:
      被替换的方块的 BlockState.

  - ### getBlockAgainst

    @NotNull public @NotNull Block getBlockAgainst()
    获取这个方块是依附在哪个方块上放置的.

    原文:Gets the block that this block was placed against

    返回:
      放置时依附的方块

  - ### getItemInHand

    @NotNull public @NotNull ItemStack getItemInHand()
    获取玩家放置的方块的物品形式(在玩家手上).

    原文:Gets the item in the player's hand when they placed the block.

    返回:
      这个方块的ItemStack对象

  - ### getHand

    @NotNull public @NotNull EquipmentSlot getHand()
    获取放置这个方块的手.

    原文:Gets the hand which placed the block

    返回:
      主手或副手，取决于放置方块所用的手

  - ### canBuild

    public boolean canBuild()
    获取这个方块是否可以建造.

    默认情况下，如果玩家还在重生/生成时服务器将阻止它们. 注意，这跟BLOCK_CANBUILD是完全不同的检测.这是指玩家而不是像仙人掌一样的物理现象.

    原文：Gets the value whether the player would be allowed to build here. Defaults to spawn if the server was going to stop them (such as, the player is in Spawn). Note that this is an entirely different check than BLOCK_CANBUILD, as this refers to a player, not universe-physics rule like cactus on dirt.

    返回:
      boolean 服务器是否允许此方块的建造

  - ### setBuild

    public void setBuild(boolean canBuild)
    设置这个方块是否可以被放置.

    原文:Sets the canBuild state of this event. Set to true if you want the player to be able to build

    参数:
      `canBuild` - 是否允许玩家放置这个方块

  - ### getHandlers

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

  - ### getHandlerList

    @NotNull public static @NotNull HandlerList getHandlerList()