Class SpawnEntityEvent
java.lang.Object
org.bukkit.event.Event
com.sk89q.worldguard.bukkit.event.DelegateEvent
com.sk89q.worldguard.bukkit.event.entity.SpawnEntityEvent
- All Implemented Interfaces:
Handleable
,org.bukkit.event.Cancellable
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 an entity is spawned.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionSpawnEntityEvent
(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.entity.Entity target) SpawnEntityEvent
(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location location, org.bukkit.entity.EntityType type) -
Method Summary
Modifier and TypeMethodDescriptionboolean
filter
(com.google.common.base.Predicate<org.bukkit.Location> predicate, boolean cancelEventOnFalse) Filter the list of affected entities with the given predicate.org.bukkit.entity.EntityType
Get the effective entity type of the spawned entity.org.bukkit.entity.Entity
Get the target entity being affected.static org.bukkit.event.HandlerList
org.bukkit.event.HandlerList
org.bukkit.Location
Get the target location being affected.org.bukkit.World
getWorld()
Get the world.Methods inherited from class com.sk89q.worldguard.bukkit.event.DelegateEvent
getCause, getOriginalEvent, getRelevantFlags, getResult, isCancelled, isSilent, setAllowed, setCancelled, setResult, setSilent
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
SpawnEntityEvent
public SpawnEntityEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.entity.Entity target) -
SpawnEntityEvent
public SpawnEntityEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.Location location, org.bukkit.entity.EntityType type)
-
-
Method Details
-
getEffectiveType
public org.bukkit.entity.EntityType getEffectiveType()Get the effective entity type of the spawned entity.- Returns:
- the effective type
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()- Specified by:
getHandlers
in classorg.bukkit.event.Event
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList() -
getWorld
public org.bukkit.World getWorld()Get the world.- Returns:
- the world
-
getTarget
public org.bukkit.Location getTarget()Get the target location being affected.- Returns:
- a location
-
getEntity
@Nullable public org.bukkit.entity.Entity getEntity()Get the target entity being affected.- Returns:
- a entity
-
filter
public boolean filter(com.google.common.base.Predicate<org.bukkit.Location> predicate, boolean cancelEventOnFalse) Filter the list of affected entities with the given predicate. If the predicate returnsfalse
, then the entity is not affected.- Parameters:
predicate
- the predicatecancelEventOnFalse
- true to cancel the event and clear the entity list once the predicate returnsfalse
- Returns:
- true if one or more entities were filtered out
-