SPIGOT-2387: Magma does not provide a block for EntityDamageEvent.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2016-06-11 16:11:51 +10:00
parent 1a8b83514c
commit a9e1194e19
3 changed files with 15 additions and 5 deletions

View File

@@ -483,8 +483,8 @@ public class CraftEventFactory {
event.getEntity().setLastDamageCause(event);
}
return event;
} else if (source == DamageSource.LAVA || source == DamageSource.HOT_FLOOR) {
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), (source == DamageSource.LAVA) ? DamageCause.LAVA : DamageCause.HOT_FLOOR, modifiers, modifierFunctions));
} else if (source == DamageSource.LAVA) {
EntityDamageEvent event = callEvent(new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.LAVA, modifiers, modifierFunctions));
if (!event.isCancelled()) {
event.getEntity().setLastDamageCause(event);
}
@@ -495,6 +495,8 @@ public class CraftEventFactory {
blockDamage = null;
if (source == DamageSource.CACTUS) {
cause = DamageCause.CONTACT;
} else if (source == DamageSource.HOT_FLOOR) {
cause = DamageCause.HOT_FLOOR;
} else {
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager, source.translationIndex));
}