Class BlockDestroyEvent

All Implemented Interfaces:

public class BlockDestroyEvent extends BlockEvent implements 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.
  • Constructor Details

  • Method Details

    • getNewState

      @NotNull public @NotNull BlockData getNewState()
      The new state of this block (Air, or a Fluid type)
    • willDrop

      public boolean willDrop()
      If the server is going to drop the block in question with this destroy event
    • playEffect

      public boolean playEffect()
      If the server is going to play the sound effect for this destruction
    • setPlayEffect

      public void setPlayEffect(boolean playEffect)
      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 interface Cancellable
      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 interface Cancellable
      cancel - true if you wish to cancel this event
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()