From 771c41c691fe71af78039b747f565a2c8320b6a9 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Tue, 7 Jan 2014 00:25:11 -0500 Subject: [PATCH] [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. --- .../java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 721215475c..a91ffb1755 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -455,8 +455,10 @@ public class CraftEventFactory { if (!(source instanceof EntityDamageSource)) { return false; } - // We don't need to check for null, since EntityDamageSource will always return an event EntityDamageEvent event = handleEntityDamageEvent(entity, source, damage); + if (event == null) { + return false; + } return event.isCancelled() || event.getDamage() == 0; }