[Bleeding] Fixed potions throwing double events. Fixes BUKKIT-1332
By: feildmaster <admin@feildmaster.com>
This commit is contained in:
parent
c925bcb49d
commit
ae4b2591f7
1 changed files with 7 additions and 4 deletions
|
@ -364,14 +364,17 @@ public class CraftEventFactory {
|
||||||
|
|
||||||
public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, int damage) {
|
public static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, int damage) {
|
||||||
Entity damager = source.getEntity();
|
Entity damager = source.getEntity();
|
||||||
EntityDamageEvent.DamageCause cause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
|
DamageCause cause = DamageCause.ENTITY_ATTACK;
|
||||||
|
|
||||||
if (source instanceof EntityDamageSourceIndirect) {
|
if (source instanceof EntityDamageSourceIndirect) {
|
||||||
damager = ((EntityDamageSourceIndirect) source).getProximateDamageSource();
|
damager = ((EntityDamageSourceIndirect) source).getProximateDamageSource();
|
||||||
if (damager.getBukkitEntity() instanceof Projectile) {
|
if (damager.getBukkitEntity() instanceof ThrownPotion) {
|
||||||
cause = EntityDamageEvent.DamageCause.PROJECTILE;
|
cause = DamageCause.MAGIC;
|
||||||
} // Else, magic..?
|
} else if (damager.getBukkitEntity() instanceof Projectile) {
|
||||||
|
cause = DamageCause.PROJECTILE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return callEntityDamageEvent(damager, entity, cause, damage);
|
return callEntityDamageEvent(damager, entity, cause, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue