diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/Damager.java | 11 | ||||
-rw-r--r-- | src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/dev/genbyte/sunfright/Damager.java b/src/main/java/dev/genbyte/sunfright/Damager.java index 8c223fb..42d6133 100644 --- a/src/main/java/dev/genbyte/sunfright/Damager.java +++ b/src/main/java/dev/genbyte/sunfright/Damager.java @@ -51,6 +51,11 @@ public class Damager extends BukkitRunnable { Damageable helmetDamageable = (Damageable) helmetMeta; int helmetDamage = helmetDamageable.getDamage(); + if (helmet.getEnchantmentLevel(Enchantment.PROTECTION_FIRE) < 1) { + applyDamage(); + return; + } + if (helmetDamage + damage >= helmet.getType().getMaxDurability()) { if (helmet.getEnchantmentLevel(Enchantment.VANISHING_CURSE) == 2) { int bindLevel = helmet.getEnchantmentLevel(Enchantment.BINDING_CURSE); @@ -71,8 +76,12 @@ public class Damager extends BukkitRunnable { } } } else { - player.damage(damage * 2); + applyDamage(); } } + + private void applyDamage() { + player.damage(damage * 2); + } } } diff --git a/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java b/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java index 5f57cef..c164536 100644 --- a/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java +++ b/src/main/java/dev/genbyte/sunfright/events/HelmetHandler.java @@ -17,6 +17,7 @@ public class HelmetHandler implements Listener { ItemStack stack = new ItemStack(Material.LEATHER_HELMET); stack.addUnsafeEnchantment(Enchantment.BINDING_CURSE, 1); stack.addUnsafeEnchantment(Enchantment.VANISHING_CURSE, 2); + stack.addEnchantment(Enchantment.PROTECTION_FIRE, 1); inv.setHelmet(stack); } |