Fixed canEnchantItem with singular types

This commit is contained in:
Auxilor
2021-12-07 08:24:28 +00:00
parent 28304d0ebe
commit 6f3ecc726f

View File

@@ -445,7 +445,15 @@ public abstract class EcoEnchant extends Enchantment implements Listener, Watche
*/
@Override
public boolean canEnchantItem(@NotNull final ItemStack itemStack) {
return targetMaterials.contains(itemStack.getType()) || itemStack.getType().equals(Material.BOOK) || itemStack.getType().equals(Material.ENCHANTED_BOOK);
if (this.type.isSingular() && EcoEnchants.hasAnyOfType(itemStack, this.type)) {
return false;
}
if (itemStack.getType() == Material.BOOK || itemStack.getType() == Material.ENCHANTED_BOOK) {
return true;
}
return targetMaterials.contains(itemStack.getType());
}
/**