Class ArenaExplosionEvent

java.lang.Object
org.bukkit.event.Event
de.marcely.bedwars.api.event.arena.ArenaExplosionEvent
All Implemented Interfaces:
ArenaEvent, Cancellable

public class ArenaExplosionEvent extends Event implements ArenaEvent, Cancellable
Gets called for TNTs, Fireballs, etc. causing an explosion during a match
  • Constructor Details

  • Method Details

    • getExplosive

      public Object getExplosive()
      Returns the Entity or Block that caused the explosion.
      Returns:
      The entity or block that caused the explosion
    • isExplosiveFireball

      public boolean isExplosiveFireball()
      Returns whether a fireball caused the explosion.
      Returns:
      true if getExplosive() is a Fireball entity
    • isExplosiveTNT

      public boolean isExplosiveTNT()
      Returns whether a fireball caused the explosion.
      Returns:
      true if getExplosive() is a TNTPrimed entity or a TNT block
    • getCenterLocation

      public Location getCenterLocation()
      Returns the absolute center location, in which the explosion occured.

      For performance reasons, its reference is not cloned with calls.

      Returns:
      The center location of the explosion
    • getYield

      public float getYield()
      Returns the yield/size of the explosion.
      Returns:
      The explosion's yield
    • getCreatorUUID

      @Nullable public @Nullable UUID getCreatorUUID()
      Returns the UUID of the player that caused the explosion.

      E.g. for TNT, it's the person who placed it. For fireballs, it's the person who had shot it. May not be present if it's not known who had caused it.

      Returns:
      The player's UUID who had caused the explosion. May be null
    • getFilters

      public List<ArenaExplosionEvent.BlockFilter> getFilters()
      Returns a modifiable list of all filters.

      For each block non-air block that is in range of the explosion, and thus has the potential to get destroyed, will get iterated through by a filter. It decides on whether the block shall be broken or not.

      You may modify this list to your liking. Do note that - for performance reasons - the check through all filters does not happen if the first entry is ArenaExplosionEvent.BlockFilter.ALL.

      Returns:
      All filters deciding on which blocks shall be broken
    • addFilterAsLast

      public void addFilterAsLast(ArenaExplosionEvent.BlockFilter filter)
      Add a filter to the end of the list.
      Parameters:
      filter - The filter to be added
      Throws:
      IllegalArgumentException - ArenaExplosionEvent.BlockFilter.ALL may only be added as first
      See Also:
    • addFilterAsFirst

      public void addFilterAsFirst(ArenaExplosionEvent.BlockFilter filter)
      Add a filter to the start of the list.

      Might not be added to the first index of the list, if it is already occupied by ArenaExplosionEvent.BlockFilter.ALL. For performance reasons in this case, the filter is being added to the second index instead.

      Parameters:
      filter - The filter to be added
      See Also:
    • hasKeepAllFilter

      public boolean hasKeepAllFilter()
      Returns whether the first filter is ArenaExplosionEvent.BlockFilter.ALL.

      In this case, all blocks are kept and none are being broken.

      Returns:
      Get whether there is a filter that causes no blocks to be broken at all
    • getHandlers

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

      public static HandlerList getHandlerList()