001 package org.bukkit.event.entity; 002 003 import java.util.Map; 004 005 import com.google.common.base.Function; 006 import org.bukkit.entity.Entity; 007 008 /** 009 * Called when an entity is damaged by an entity 010 */ 011 public class EntityDamageByEntityEvent extends EntityDamageEvent { 012 private final Entity damager; 013 014 @Deprecated 015 public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final int damage) { 016 this(damager, damagee, cause, (double) damage); 017 } 018 019 @Deprecated 020 public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final double damage) { 021 super(damagee, cause, damage); 022 this.damager = damager; 023 } 024 025 public EntityDamageByEntityEvent(final Entity damager, final Entity damagee, final DamageCause cause, final Map<DamageModifier, Double> modifiers, final Map<DamageModifier, ? extends Function<? super Double, Double>> modifierFunctions) { 026 super(damagee, cause, modifiers, modifierFunctions); 027 this.damager = damager; 028 } 029 030 /** 031 * Returns the entity that damaged the defender. 032 * 033 * @return Entity that damaged the defender. 034 */ 035 public Entity getDamager() { 036 return damager; 037 } 038 }