Class BlockDestroyEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockExpEvent
com.destroystokyo.paper.event.block.BlockDestroyEvent
- All Implemented Interfaces:
Cancellable
Fired anytime the server intends to 'destroy' a block through some triggering reason.
This does not fire anytime a block is set to air, but only with more direct triggers such
as physics updates, pistons, Entities changing blocks, commands set to "Destroy".
This event is associated with the game playing a sound effect at the block in question, when something can be described as "intend to destroy what is there",
Events such as leaves decaying, pistons retracting (where the block is moving), does NOT fire this event.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.block.BlockEvent
block
-
Constructor Summary
ConstructorDescriptionBlockDestroyEvent
(Block block, BlockData newState, BlockData effectBlock, int xp, boolean willDrop) -
Method Summary
Modifier and TypeMethodDescriptionGet the effect that will be played when the block is broken.static HandlerList
boolean
Gets the cancellation state of this event.boolean
void
setCancelled
(boolean cancel) If the event is cancelled, the block will remain in its previous state.void
setEffectBlock
(BlockData effectBlock) Sets the effect that will be played when the block is broken.void
setPlayEffect
(boolean playEffect) void
setWillDrop
(boolean willDrop) boolean
willDrop()
Methods inherited from class org.bukkit.event.block.BlockExpEvent
getExpToDrop, setExpToDrop
Methods inherited from class org.bukkit.event.block.BlockEvent
getBlock
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
BlockDestroyEvent
-
-
Method Details
-
getEffectBlock
Get the effect that will be played when the block is broken.- Returns:
- block break effect
-
setEffectBlock
Sets the effect that will be played when the block is broken. Note:playEffect()
must betrue
in order for this effect to be played.- Parameters:
effectBlock
- block effect
-
getNewState
- Returns:
- The new state of this block (Air, or a Fluid type)
-
willDrop
public boolean willDrop()- Returns:
- If the server is going to drop the block in question with this destroy event
-
setWillDrop
public void setWillDrop(boolean willDrop) - Parameters:
willDrop
- If the server is going to drop the block in question with this destroy event
-
playEffect
public boolean playEffect()- Returns:
- If the server is going to play the sound effect for this destruction
-
setPlayEffect
public void setPlayEffect(boolean playEffect) - Parameters:
playEffect
- If the server should play the sound effect for this destruction
-
isCancelled
public boolean isCancelled()Description copied from interface: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- Specified by:
isCancelled
in interfaceCancellable
- Returns:
- If the event is cancelled, meaning the block will not be destroyed
-
setCancelled
public void setCancelled(boolean cancel) If the event is cancelled, the block will remain in its previous state.- Specified by:
setCancelled
in interfaceCancellable
- Parameters:
cancel
- true if you wish to cancel this event
-
getHandlers
- Overrides:
getHandlers
in classBlockExpEvent
-
getHandlerList
-