Package org.bukkit.event.entity
Class EntityDamageByBlockEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.entity.EntityEvent
org.bukkit.event.entity.EntityDamageEvent
org.bukkit.event.entity.EntityDamageByBlockEvent
- All Implemented Interfaces:
Cancellable
Called when an entity is damaged by a block
For explosions, the Block returned by getDamager()
has
already been cleared. See getDamagerBlockState()
for a snapshot
of the block if it has already been changed.
-
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
ConstructorDescriptionEntityDamageByBlockEvent
(@Nullable Block damager, @Nullable BlockState damagerState, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, @NotNull DamageSource damageSource, double damage) EntityDamageByBlockEvent
(@Nullable Block damager, @Nullable BlockState damagerState, @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) EntityDamageByBlockEvent
(@Nullable Block damager, @NotNull Entity damagee, @NotNull EntityDamageEvent.DamageCause cause, double damage) Deprecated, for removal: This API element is subject to removal in a future version.EntityDamageByBlockEvent
(@Nullable Block 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. -
Method Summary
Modifier and TypeMethodDescriptionReturns the block that damaged the player.Returns the captured BlockState of the block that damaged the player.Methods inherited from class org.bukkit.event.entity.EntityDamageEvent
getCause, getDamage, getDamage, getDamageSource, 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
-
EntityDamageByBlockEvent
@Deprecated(forRemoval=true) public EntityDamageByBlockEvent(@Nullable @Nullable Block 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. -
EntityDamageByBlockEvent
public EntityDamageByBlockEvent(@Nullable @Nullable Block damager, @Nullable @Nullable BlockState damagerState, @NotNull @NotNull Entity damagee, @NotNull @NotNull EntityDamageEvent.DamageCause cause, @NotNull @NotNull DamageSource damageSource, double damage) -
EntityDamageByBlockEvent
@Deprecated(forRemoval=true) public EntityDamageByBlockEvent(@Nullable @Nullable Block 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. -
EntityDamageByBlockEvent
public EntityDamageByBlockEvent(@Nullable @Nullable Block damager, @Nullable @Nullable BlockState damagerState, @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)
-
-
Method Details
-
getDamager
Returns the block that damaged the player.- Returns:
- Block that damaged the player
-
getDamagerBlockState
Returns the captured BlockState of the block that damaged the player.This block state is not placed so
BlockState.isPlaced()
will be false.- Returns:
- the block state
-