类 BlockDropItemEvent

所有已实现的接口:
Cancellable

public class BlockDropItemEvent extends BlockEvent implements Cancellable
当一个方块被玩家破坏且掉落物品时触发本事件. 如果方块破坏事件(BlockBreakEvent)被取消, 那么将不会触发本事件. 如果将 BlockBreakEvent 中的 isDropItems 设置为 false (通过 BlockBreakEvent 中的 setDropItems 方法设置), 也不会触发本事件. 如果玩家破坏了一个多方块结构, 例如在石头顶部的火把, 本事件也会被调用. 所有结构的掉落物计入同一个事件内. 当调用本事件时, 意味着此方块已经被破坏, 因此 #getBlock() 大部分情况是 AIR. 请使用 #getBlockState() 获取有关此被破坏的方块的更多信息.
  • 构造器详细资料

  • 方法详细资料

    • getPlayer

      @NotNull public @NotNull Player getPlayer()
      获取破坏这个方块的玩家.

      原文:Gets the Player that is breaking the block involved in this event.

      返回:
      破坏这个方块的玩家
    • getBlockState

      @NotNull public @NotNull BlockState getBlockState()
      获取被破坏的方块的BlockState.

      原文:Gets the BlockState of the block involved in this event before it was broken.

      返回:
      被破坏的方块的BlockState
    • getItems

      @NotNull public @NotNull List<Item> getItems()
      获取由于破坏方块而产生的掉落物实体的列表. 这个列表是可变的 - 移除在列表中的物品将导致其不会掉落. 然而向这个列表添加新的物品是不合法的.

      原文:Gets list of the Item drops caused by the block break. This list is mutable - removing an item from it will cause it to not drop. It is not legal however to add new items to the list.

      返回:
      方块被破坏后产生的掉落物的列表
    • 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
    • getHandlers

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

      @NotNull public static @NotNull HandlerList getHandlerList()