BlockDamageEvent
BlockDamageEvent
=> org.bukkit.event.Event
=> org.bukkit.event.block.BlockEvent
=> org.bukkit.event.block.BlockDamageEvent
Called when a block is damaged by a player.If a Block Damage event is cancelled, the block will not be damaged.当玩家尝试挖掘方块时触发。如果本事件被取消,则涉事方块将不会再处于被挖掘中的状态。译注:本事件是在玩家开始挖掘时触发的,只要玩家左键点击了方块一瞬,就可以触发此事件。而BlockBreakEvent
是在方块被完全破坏以后触发的。如果对该BlockBreakEvent
对象调用isDropItems()
方法,返回值不为false
,且该BlockBreakEvent
未被取消,则会在BlockBreakEvent
触发后再触发BlockDropItemEvent
。客户端显示可能存在延迟,有时取消事件后,挖掘方块的玩家仍然可以观察到挖掘过程中方块上的裂纹,即使松开鼠标停止挖掘,这个裂纹仍然不会消失。此时可以从另一个玩家的视角来观察,以确定挖掘是否停止。
方法声明: public Player getPlayer()
方法签名: ()Lorg/bukkit/entity/Player;
Gets the player damaging the block involved in this event.@return The player damaging the block involved in this event该方法用于获取挖掘方块的涉事玩家。@return 挖掘方块的涉事玩家。
方法声明: public boolean getInstaBreak()
方法签名: ()Z
Gets if the block is set to instantly break when damaged by the player.@return true if the block should instantly break when damaged by theplayer该方法用于获取玩家是否能瞬间破坏方块。@return 如果玩家可以瞬间破坏方块,则返回true
。
方法声明: public void setInstaBreak(boolean bool)
方法签名: (Z)V
Sets if the block should instantly break when damaged by the player.@param bool true if you want the block to instantly break when damagedby the player该方法用于设置玩家是否能瞬间破坏方块。@param bool 如欲令玩家可以瞬间破坏方块,则传入true
。
方法声明: public ItemStack getItemInHand()
方法签名: ()Lorg/bukkit/inventory/ItemStack;
Gets the ItemStack for the item currently in the player's hand.@return The ItemStack for the item currently in the player's hand该方法用于获取涉事玩家手持的物品堆。@return 涉事玩家手持的物品堆。
方法声明: public boolean isCancelled()
方法签名: ()Z
方法声明: public void setCancelled(boolean cancel)
方法签名: (Z)V
方法声明: public HandlerList getHandlers()
方法签名: ()Lorg/bukkit/event/HandlerList;
方法声明: public static HandlerList getHandlerList()
方法签名: ()Lorg/bukkit/event/HandlerList;
Last modified 1mo ago