Fixed severe anvil bug

This commit is contained in:
Auxilor 2021-01-12 19:12:42 +00:00
parent ecda560a56
commit 61a913b178

View File

@ -1,13 +1,11 @@
package com.willfp.ecoenchants.enchantments.support.merging.anvil;
import com.willfp.eco.util.ProxyUtils;
import com.willfp.eco.util.config.Configs;
import com.willfp.eco.util.tuplets.Pair;
import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import com.willfp.ecoenchants.proxy.proxies.FastGetEnchantsProxy;
import lombok.experimental.UtilityClass;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@ -111,13 +109,13 @@ public class AnvilMerge {
if (left.getItemMeta() instanceof EnchantmentStorageMeta) {
leftEnchants.putAll(((EnchantmentStorageMeta) left.getItemMeta()).getStoredEnchants());
} else {
rightEnchants.putAll(ProxyUtils.getProxy(FastGetEnchantsProxy.class).getEnchantmentsOnItem(left));
leftEnchants.putAll(left.getItemMeta().getEnchants());
}
if (right.getItemMeta() instanceof EnchantmentStorageMeta) {
rightEnchants.putAll(((EnchantmentStorageMeta) right.getItemMeta()).getStoredEnchants());
} else {
rightEnchants.putAll(ProxyUtils.getProxy(FastGetEnchantsProxy.class).getEnchantmentsOnItem(right));
rightEnchants.putAll(right.getItemMeta().getEnchants());
}
leftEnchants.forEach(((enchantment, integer) -> {
@ -151,14 +149,14 @@ public class AnvilMerge {
}
});
leftEnchants.forEach(((enchantment1, integer1) -> {
leftEnchants.forEach((enchantment1, integer1) -> {
if (enchantment.conflictsWith(enchantment1)) {
doesConflict.set(true);
}
if (enchantment1.conflictsWith(enchantment)) {
doesConflict.set(true);
}
}));
});
boolean canEnchantItem = enchantment.canEnchantItem(left);
if (left.getItemMeta() instanceof EnchantmentStorageMeta) {