类 BlockBreakEvent
- 所有已实现的接口:
- Cancellable
如果你想要在方块被破坏之后掉落经验, 你必须设置经验值 为0以上。 默认情况下, 如果满足以下条件,经验会被设置:
- 玩家不能是创造/冒险模式
- 玩家能掠夺这个方块 - 即使用了正确的工具破坏方块, 不是完全破坏它(译注:完全破坏可理解为破坏方块不产生任何掉落物. 这条情况的常见情景有开采矿石等)
- 玩家没有精准采集
- 方块在原版Minecraft中掉落经验
注意: 插件要模拟一个方块掉落应该设置空气为方块,利用自己的方法确定方块被破坏后默认掉落什么,和要做什么。
如果方块破坏事件(即本事件)被取消,这个方块将不会被破坏,并且经验不会掉落。
- 
嵌套类概要从类继承的嵌套类/接口 org.bukkit.event.EventEvent.Result
- 
字段概要从类继承的字段 org.bukkit.event.block.BlockEventblock
- 
构造器概要构造器
- 
方法概要修饰符和类型方法说明获取破坏这个方块的玩家.boolean获取这个事件是否被取消.一个被取消的事件不会在服务器里执行,但是仍然会传递事件到其他插件.boolean获取方块是否可能掉落物品.voidsetCancelled(boolean cancel) 取消这个事件.voidsetDropItems(boolean dropItems) 设置破坏这个方块后是否像平常那样尝试掉落物品.从类继承的方法 org.bukkit.event.block.BlockExpEventgetExpToDrop, getHandlerList, getHandlers, setExpToDrop从类继承的方法 org.bukkit.event.block.BlockEventgetBlock从类继承的方法 org.bukkit.event.EventgetEventName, isAsynchronous
- 
构造器详细资料- 
BlockBreakEvent
 
- 
- 
方法详细资料- 
getPlayer获取破坏这个方块的玩家.原文:Gets the Player that is breaking the block involved in this event. - 返回:
- 破坏这个方块的玩家
 
- 
setDropItemspublic void setDropItems(boolean dropItems) 设置破坏这个方块后是否像平常那样尝试掉落物品. 当且仅当设为 false 时,BlockDropItemEvent事件将不会在本事件后触发.原文:Sets whether or not the block will attempt to drop items as it normally would. If and only if this is false then BlockDropItemEventwill not be called after this event.- 参数:
- dropItems- 这个方块是否尝试掉落物品 (注:设为 true 时只代表可能掉落, 而非 100% 掉落)
 
- 
isDropItemspublic boolean isDropItems()获取方块是否可能掉落物品.原文:Gets whether or not the block will attempt to drop items. If and only if this is false then BlockDropItemEventwill not be called after this event.- 返回:
- 这个方块是否掉落物品
 
- 
isCancelledpublic 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
 
- 
setCancelledpublic 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
 
 
-