mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 20:23:53 -07: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:
@@ -94,6 +94,7 @@ public class BlockCactus extends Block {
|
||||
world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
damagee.setLastDamageCause(event);
|
||||
entity.damageEntity(DamageSource.CACTUS, event.getDamage());
|
||||
}
|
||||
return;
|
||||
|
Reference in New Issue
Block a user