Class DamageEntityEvent
java.lang.Object
org.bukkit.event.Event
com.sk89q.worldguard.bukkit.event.DelegateEvent
com.sk89q.worldguard.bukkit.event.entity.DamageEntityEvent
- 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 damaged.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorDescriptionDamageEntityEvent
(org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.entity.Entity target) -
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.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
-
DamageEntityEvent
public DamageEntityEvent(@Nullable org.bukkit.event.Event originalEvent, Cause cause, org.bukkit.entity.Entity target)
-
-
Method Details
-
getEntity
@Nonnull public org.bukkit.entity.Entity getEntity()Get the target entity being affected.- Returns:
- a entity
-
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
-
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
-