mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 17:57:34 +01:00
SPIGOT-6639: During an EntityDamageEvent with damage from blocks, damaging any entity throws an error
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
parent
a8b86ea421
commit
cf4feec6b5
@ -893,7 +893,12 @@ public class CraftEventFactory {
|
||||
} else if (source == DamageSource.LAVA) {
|
||||
EntityDamageEvent event = (new EntityDamageByBlockEvent(blockDamage, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
|
||||
event.setCancelled(cancelled);
|
||||
|
||||
Block damager = blockDamage;
|
||||
blockDamage = null; // SPIGOT-6639: Clear blockDamage to allow other entity damage during event call
|
||||
callEvent(event);
|
||||
blockDamage = damager; // SPIGOT-6639: Re-set blockDamage so that other entities which are also getting damaged have the right cause
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
event.getEntity().setLastDamageCause(event);
|
||||
} else {
|
||||
@ -916,7 +921,11 @@ public class CraftEventFactory {
|
||||
}
|
||||
EntityDamageEvent event = new EntityDamageByBlockEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions);
|
||||
event.setCancelled(cancelled);
|
||||
|
||||
blockDamage = null; // SPIGOT-6639: Clear blockDamage to allow other entity damage during event call
|
||||
callEvent(event);
|
||||
blockDamage = damager; // SPIGOT-6639: Re-set blockDamage so that other entities which are also getting damaged have the right cause
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
event.getEntity().setLastDamageCause(event);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user