Class PlaceBlockEvent

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

public class PlaceBlockEvent 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 placed.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.bukkit.event.Event

    org.bukkit.event.Event.Result
  • Constructor Summary

    Constructors
    Constructor
    Description
    PlaceBlockEvent(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.block.Block block)
     
    PlaceBlockEvent(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location target, org.bukkit.Material effectiveMaterial)
     
    PlaceBlockEvent(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.World world, List<org.bukkit.block.Block> blocks, org.bukkit.Material effectiveMaterial)
     
    PlaceBlockEvent(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.World world, List<org.bukkit.block.BlockState> blocks)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    filter(Predicate<org.bukkit.Location> predicate)
    Filter the list of affected blocks with the given predicate.
    boolean
    filter(Predicate<org.bukkit.Location> predicate, boolean cancelEventOnFalse)
    Filter the list of affected blocks with the given predicate.
    List<org.bukkit.block.Block>
    Get the affected blocks.
    org.bukkit.Material
    Get the effective material of the block, regardless of what the block currently is.
    org.bukkit.event.Event.Result
    Get the actual result.
    static org.bukkit.event.HandlerList
     
    org.bukkit.event.HandlerList
     
    org.bukkit.event.Event.Result
     
    org.bukkit.World
    Get the world.

    Methods inherited from class com.sk89q.worldguard.bukkit.event.DelegateEvent

    getCause, getOriginalEvent, getRelevantFlags, isCancelled, isSilent, setAllowed, setCancelled, setResult, setSilent

    Methods inherited from class org.bukkit.event.Event

    callEvent, getEventName, isAsynchronous

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PlaceBlockEvent

      public PlaceBlockEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.World world, List<org.bukkit.block.BlockState> blocks)
    • PlaceBlockEvent

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

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

      public PlaceBlockEvent(@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