Package org.bukkit.event.entity
Class EntityDamageByEntityEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityDamageEvent
org.bukkit.event.entity.EntityDamageByEntityEvent
- All Implemented Interfaces:
Cancellable
Called when an entity is damaged by an entity
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.entity.EntityDamageEvent
EntityDamageEvent.DamageCause, EntityDamageEvent.DamageModifier
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.entity.EntityEvent
entity
-
Constructor Summary
ConstructorDescriptionEntityDamageByEntityEvent
(@NotNull Entity damager, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, double damage) Deprecated, for removal: This API element is subject to removal in a future version.EntityDamageByEntityEvent
(@NotNull Entity damager, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, @NotNull Map<EntityDamageEvent.DamageModifier, Double> modifiers, @NotNull Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) Deprecated, for removal: This API element is subject to removal in a future version.EntityDamageByEntityEvent
(@NotNull Entity damager, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, @NotNull DamageSource damageSource, double damage) Deprecated.EntityDamageByEntityEvent
(@NotNull Entity damager, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, @NotNull DamageSource damageSource, @NotNull Map<EntityDamageEvent.DamageModifier, Double> modifiers, @NotNull Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) Deprecated.EntityDamageByEntityEvent
(@NotNull Entity damager, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, @NotNull DamageSource damageSource, @NotNull Map<EntityDamageEvent.DamageModifier, Double> modifiers, @NotNull Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions, boolean critical) -
Method Summary
Modifier and TypeMethodDescriptionReturns the entity that damaged the defender.Get the source of damage.boolean
Shows this damage instance was critical.Methods inherited from class org.bukkit.event.entity.EntityDamageEvent
getCause, getDamage, getDamage, getFinalDamage, getHandlerList, getHandlers, getOriginalDamage, isApplicable, isCancelled, setCancelled, setDamage, setDamage
Methods inherited from class org.bukkit.event.entity.EntityEvent
getEntity, getEntityType
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
EntityDamageByEntityEvent
@Deprecated(forRemoval=true) public EntityDamageByEntityEvent(@NotNull @NotNull Entity damager, @NotNull @NotNull Entity damagee, @NotNull @NotNull EntityDamageEvent.DamageCause cause, double damage) Deprecated, for removal: This API element is subject to removal in a future version. -
EntityDamageByEntityEvent
@Deprecated public EntityDamageByEntityEvent(@NotNull @NotNull Entity damager, @NotNull @NotNull Entity damagee, @NotNull @NotNull EntityDamageEvent.DamageCause cause, @NotNull @NotNull DamageSource damageSource, double damage) Deprecated. -
EntityDamageByEntityEvent
@Deprecated(forRemoval=true) public EntityDamageByEntityEvent(@NotNull @NotNull Entity damager, @NotNull @NotNull Entity damagee, @NotNull @NotNull EntityDamageEvent.DamageCause cause, @NotNull @NotNull Map<EntityDamageEvent.DamageModifier, Double> modifiers, @NotNull @NotNull Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) Deprecated, for removal: This API element is subject to removal in a future version. -
EntityDamageByEntityEvent
@Deprecated public EntityDamageByEntityEvent(@NotNull @NotNull Entity damager, @NotNull @NotNull Entity damagee, @NotNull @NotNull EntityDamageEvent.DamageCause cause, @NotNull @NotNull DamageSource damageSource, @NotNull @NotNull Map<EntityDamageEvent.DamageModifier, Double> modifiers, @NotNull @NotNull Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) Deprecated. -
EntityDamageByEntityEvent
@Internal public EntityDamageByEntityEvent(@NotNull @NotNull Entity damager, @NotNull @NotNull Entity damagee, @NotNull @NotNull EntityDamageEvent.DamageCause cause, @NotNull @NotNull DamageSource damageSource, @NotNull @NotNull Map<EntityDamageEvent.DamageModifier, Double> modifiers, @NotNull @NotNull Map<EntityDamageEvent.DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions, boolean critical)
-
-
Method Details
-
isCritical
public boolean isCritical()Shows this damage instance was critical. The damage instance can be critical if the attacking player met the respective conditions. Furthermore, arrows may also cause a critical damage event if the arrowAbstractArrow.isCritical()
.- Returns:
- if the hit was critical.
- See Also:
-
getDamageSource
Get the source of damage.The
DamageSource.getDirectEntity()
may be different from thegetDamager()
if the Minecraft damage source did not originally include an damager entity, but one was included for this eventgetDamager()
.- Overrides:
getDamageSource
in classEntityDamageEvent
- Returns:
- a DamageSource detailing the source of the damage.
-
getDamager
Returns the entity that damaged the defender.- Returns:
- Entity that damaged the defender.
-