Class ArenaExplosionEvent
- All Implemented Interfaces:
ArenaEvent, Cancellable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDecides on whether a block shall be broken due to an explosionNested classes/interfaces inherited from class Event
Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionArenaExplosionEvent(Arena arena, Object explosive, Location locCenter, float yield, @Nullable UUID creatorUUID, List<ArenaExplosionEvent.BlockFilter> filters) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a filter to the start of the list.voidAdd a filter to the end of the list.Returns the absolute center location, in which the explosion occured.@Nullable UUIDReturns the UUID of the player that caused the explosion.Returns a modifiable list of all filters.static HandlerListfloatgetYield()Returns the yield/size of the explosion.booleanReturns whether the first filter isArenaExplosionEvent.BlockFilter.ALL.booleanReturns whether a fireball caused the explosion.booleanReturns whether a fireball caused the explosion.Methods inherited from class Event
getEventName, isAsynchronousMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ArenaEvent
getArenaMethods inherited from interface Cancellable
isCancelled, setCancelled
-
Constructor Details
-
ArenaExplosionEvent
-
-
Method Details
-
getExplosive
-
isExplosiveFireball
public boolean isExplosiveFireball()Returns whether a fireball caused the explosion.- Returns:
trueifgetExplosive()is a Fireball entity
-
isExplosiveTNT
public boolean isExplosiveTNT()Returns whether a fireball caused the explosion.- Returns:
trueifgetExplosive()is a TNTPrimed entity or a TNT block
-
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
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
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
Add a filter to the end of the list.- Parameters:
filter- The filter to be added- Throws:
IllegalArgumentException-ArenaExplosionEvent.BlockFilter.ALLmay only be added as first- See Also:
-
addFilterAsFirst
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 isArenaExplosionEvent.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
- Specified by:
getHandlersin classEvent
-
getHandlerList
-