package com.gmail.nossr50.events.fake; import com.google.common.base.Function; import com.google.common.base.Functions; import org.bukkit.entity.Entity; import org.bukkit.event.entity.EntityDamageEvent; import java.util.EnumMap; import java.util.Map; /** * Called when mcMMO applies damage due to special abilities. */ public class FakeEntityDamageEvent extends EntityDamageEvent { public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map modifiers) { super(damagee, cause, modifiers, getFunctionModifiers(modifiers)); } @Deprecated public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) { super(damagee, cause, damage); } public static EnumMap> getFunctionModifiers(Map modifiers) { EnumMap> modifierFunctions = new EnumMap<>(DamageModifier.class); Function ZERO = Functions.constant(-0.0); for (DamageModifier modifier : modifiers.keySet()) { modifierFunctions.put(modifier, ZERO); } return modifierFunctions; } }