mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-25 09:41:29 +01:00
Apply setLastDamageCause after processing events and the event has not been canceled. Fixes BUKKIT-1881
This allows previous causes to be available during the event, as well as making the damage cause a valid one. If EntityDamageEvent is canceled, then it's not the last DamageCause. Also prevents setting DamageCause involuntarily through construction. By: feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
fdbd4efbd6
commit
87d5b5e374
@ -360,7 +360,12 @@ public class CraftEventFactory {
|
||||
} else {
|
||||
event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, damage);
|
||||
}
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
event.getEntity().setLastDamageCause(event);
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user