Class BreakBlockEvent

java.lang.Object
org.bukkit.event.Event
com.sk89q.worldguard.bukkit.event.DelegateEvent
com.sk89q.worldguard.bukkit.event.block.BreakBlockEvent
All Implemented Interfaces:
BulkEvent, Handleable, org.bukkit.event.Cancellable

public class BreakBlockEvent extends DelegateEvent
This event is an internal event. We do not recommend handling or throwing this event or its subclasses as the interface is highly subject to change.

Thrown when a block is broken.

  • Constructor Details

    • BreakBlockEvent

      public BreakBlockEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.World world, List<org.bukkit.block.Block> blocks, org.bukkit.Material effectiveMaterial)
    • BreakBlockEvent

      public BreakBlockEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.block.Block block)
    • BreakBlockEvent

      public BreakBlockEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location target, org.bukkit.Material effectiveMaterial)
  • Method Details

    • getHandlers

      public org.bukkit.event.HandlerList getHandlers()
      Specified by:
      getHandlers in class org.bukkit.event.Event
    • getHandlerList

      public static org.bukkit.event.HandlerList getHandlerList()
    • getWorld

      public org.bukkit.World getWorld()
      Get the world.
      Returns:
      the world
    • getBlocks

      public List<org.bukkit.block.Block> getBlocks()
      Get the affected blocks.
      Returns:
      a list of affected block
    • filter

      public boolean filter(Predicate<org.bukkit.Location> predicate, boolean cancelEventOnFalse)
      Filter the list of affected blocks with the given predicate. If the predicate returns false, then the block is removed.
      Parameters:
      predicate - the predicate
      cancelEventOnFalse - true to cancel the event and clear the block list once the predicate returns false
      Returns:
      true if one or more blocks were filtered out
    • filter

      public boolean filter(Predicate<org.bukkit.Location> predicate)
      Filter the list of affected blocks with the given predicate. If the predicate returns false, then the block is removed.

      This method will not fail fast and cancel the event the first instance that the predicate returns false. See filter(Predicate, boolean) to adjust this behavior.

      Parameters:
      predicate - the predicate
      Returns:
      true if one or more blocks were filtered out
    • getEffectiveMaterial

      public org.bukkit.Material getEffectiveMaterial()
      Get the effective material of the block, regardless of what the block currently is.
      Returns:
      the effective material
    • getResult

      public org.bukkit.event.Event.Result getResult()
      Specified by:
      getResult in interface Handleable
      Overrides:
      getResult in class DelegateEvent
    • getExplicitResult

      public org.bukkit.event.Event.Result getExplicitResult()
      Description copied from interface: BulkEvent
      Get the actual result.

      By default, bulk events will set the result to DENY if the number of affected objects drops to zero. This method returns the true result.

      Specified by:
      getExplicitResult in interface BulkEvent
      Returns:
      the explicit result