Class BlockDestroyEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
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(@NotNull Block block, @NotNull BlockData newState, boolean willDrop)
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull 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
setPlayEffect(boolean playEffect)
boolean
willDrop()
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
-
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
-
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
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-