mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05: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.
This commit is contained in:
1 parent
e4e994f710
commit
00efc8c464
7 files changed
+20
-1
No files matched your search
@@ -346,6 +346,7 @@ public abstract class Entity {
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
event.getEntity().setLastDamageCause(event);
|
||||
this.damageEntity(DamageSource.BURN, event.getDamage());
|
||||
}
|
||||
} else {
|
||||
@@ -390,6 +391,7 @@ public abstract class Entity {
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
damagee.setLastDamageCause(event);
|
||||
this.damageEntity(DamageSource.LAVA, event.getDamage());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user