mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-19 13:38:44 +01:00
[Bleeding] Account for null in EntityDamageEvent handling. Fixes BUKKIT-5317
Damage caused by explosions will return null for the event as of 6588d6f72bbca74bf150de65593ac575b846111b. As such, a null check is now necessary when handling non-living entity damage events. By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
parent
a4b581ad13
commit
ba1adfb79b
1 changed files with 3 additions and 1 deletions
|
@ -455,8 +455,10 @@ public class CraftEventFactory {
|
||||||
if (!(source instanceof EntityDamageSource)) {
|
if (!(source instanceof EntityDamageSource)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// We don't need to check for null, since EntityDamageSource will always return an event
|
|
||||||
EntityDamageEvent event = handleEntityDamageEvent(entity, source, damage);
|
EntityDamageEvent event = handleEntityDamageEvent(entity, source, damage);
|
||||||
|
if (event == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return event.isCancelled() || event.getDamage() == 0;
|
return event.isCancelled() || event.getDamage() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue