diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java index f8f2be83..219a3480 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/support/merging/anvil/AnvilMerge.java @@ -152,6 +152,14 @@ public class AnvilMerge { rightEnchants.remove(enchantment); } + if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled")) { + if (!player.hasPermission("ecoenchants.anvil.bypasshardcap")) { + if (outEnchants.size() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) { + return; + } + } + } + outEnchants.put(enchantment, level); })); @@ -182,10 +190,15 @@ public class AnvilMerge { canEnchantItem = true; } - if (canEnchantItem && !doesConflict.get()) { - if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled") && !player.hasPermission("ecoenchants.anvil.bypasshardcap") && outEnchants.size() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) { - return; + if (PLUGIN.getConfigYml().getBool("anvil.hard-cap.enabled")) { + if (!player.hasPermission("ecoenchants.anvil.bypasshardcap")) { + if (outEnchants.size() >= PLUGIN.getConfigYml().getInt("anvil.hard-cap.cap")) { + doesConflict.set(true); + } } + } + + if (canEnchantItem && !doesConflict.get()) { outEnchants.put(enchantment, integer); } }));