public class BlockBreakEvent extends BlockExpEvent implements Cancellable
如果你想要在方块被破坏之后掉落经验, 你必须设置经验值 为0以上。 默认情况下, 如果满足以下条件,经验会被设置:
注意: 插件要模拟一个方块掉落应该设置空气为方块,利用自己的方法确定方块被破坏后默认掉落什么,和要做什么。
如果方块破坏事件(即本事件)被取消,这个方块将不会被破坏,并且经验不会掉落。
Event.Result
block
构造器和说明 |
---|
BlockBreakEvent(Block theBlock,
Player player) |
限定符和类型 | 方法和说明 |
---|---|
Player |
getPlayer()
获取破坏这个方块的玩家.
|
boolean |
isCancelled()
获取这个事件是否被取消.一个被取消的事件不会在服务器里被执行,但是仍然会传递事件到其他插件。
|
boolean |
isDropItems()
获取方块是否会掉落物品.
|
void |
setCancelled(boolean cancel)
取消这个事件.
|
void |
setDropItems(boolean dropItems)
设置这个方块是否像平常那样掉落物品.
|
getExpToDrop, getHandlerList, getHandlers, setExpToDrop
getBlock
getEventName, isAsynchronous
public Player getPlayer()
原文:Gets the Player that is breaking the block involved in this event.
public void setDropItems(boolean dropItems)
原文:Sets whether or not the block will drop items as it normally would.
dropItems
- 这个方块是否掉落物品public boolean isDropItems()
原文:Gets whether or not the block will drop items.
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
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