Mineplex2018-withcommit/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/DamageAttribute.java

26 lines
579 B
Java
Raw Normal View History

package mineplex.game.clans.items.attributes;
import org.bukkit.entity.Entity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
public abstract class DamageAttribute extends ItemAttribute
{
private double _bonusDamage;
public DamageAttribute(ValueDistribution damageGen)
{
_bonusDamage = damageGen.generateValue();
}
@Override
public void onAttack(EntityDamageByEntityEvent event)
{
if (grantBonusDamage(event.getEntity()))
{
event.setDamage(event.getDamage() + _bonusDamage);
}
}
public abstract boolean grantBonusDamage(Entity defender);
}