Fixed /randomenchant

This commit is contained in:
Auxilor 2021-02-05 11:46:35 +00:00
parent 161e0302c9
commit 1ef8c7d0e5

View File

@ -57,7 +57,20 @@ public class CommandRandomenchant extends AbstractCommand {
if (ecoEnchant.canEnchantItem(itemStack)) { if (ecoEnchant.canEnchantItem(itemStack)) {
if (!ecoEnchant.conflictsWithAny(onItem)) { if (!ecoEnchant.conflictsWithAny(onItem)) {
if (!onItem.stream().anyMatch(enchantment -> enchantment.conflictsWith(ecoEnchant))) { if (!onItem.stream().anyMatch(enchantment -> enchantment.conflictsWith(ecoEnchant))) {
enchant = ecoEnchant; if (!onItem.contains(ecoEnchant)) {
boolean conflicts = false;
for (Enchantment enchantment : onItem) {
if (EcoEnchants.getFromEnchantment(enchantment) != null) {
EcoEnchant ecoEnchantOnItem = EcoEnchants.getFromEnchantment(enchantment);
if (ecoEnchantOnItem.getType().equals(ecoEnchant.getType()) && ecoEnchantOnItem.getType().isSingular()) {
conflicts = true;
}
}
}
if (!conflicts) {
enchant = ecoEnchant;
}
}
} }
} }
} }