Added cap for goliath

This commit is contained in:
Auxilor
2020-11-13 21:49:27 +00:00
parent 0d50c5e2a8
commit 3e0e7696f8
2 changed files with 8 additions and 1 deletions

View File

@@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.kingdoms.utils.caffeine.checkerframework.checker.units.qual.A;
public final class Goliath extends EcoEnchant {
public Goliath() {
super(
@@ -25,6 +27,10 @@ public final class Goliath extends EcoEnchant {
double damage = event.getDamage();
double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier");
double bonus = 1 + (multiplier * level * timesMoreHealth);
if(bonus - 1 > this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap")) {
bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap") + 1;
}
A
event.setDamage(damage * bonus);
}
}