类 BlockPlaceEvent

所有已实现的接口:
Cancellable
直接已知子类:
BlockMultiPlaceEvent

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

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

  • 字段详细资料

    • 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
  • 构造器详细资料

  • 方法详细资料

    • 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

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

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

      返回:
      谁放置的这个方块(Player对象)
    • getBlockPlaced

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

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

      返回:
      被放置后的方块
    • getBlockReplacedState

      public BlockState getBlockReplacedState()
      获取方块被放置后的方块状态(BlockState). 通常是空气.

      例:牌子拿在手里,放在墙上后,这个牌子的方块状态就是墙上的牌子.

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

      返回:
      被放置后的方块的方块状态对象
    • getBlockAgainst

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

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

      返回:
      Block 放置时依附的方块
    • getItemInHand

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

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

      返回:
      这个方块的ItemStack对象
    • getHand

      public 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

      public HandlerList getHandlers()
      指定者:
      getHandlers 在类中 Event
    • getHandlerList

      public static HandlerList getHandlerList()