mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-05 22:07:34 +01:00
Fixed villager trade bug
This commit is contained in:
parent
51e3b0d3a0
commit
d639eef779
@ -2,15 +2,18 @@ package com.willfp.ecoenchants.enchantments.support.obtaining;
|
||||
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.eco.core.fast.FastItemStack;
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
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.enchantments.util.EnchantmentUtils;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -26,6 +29,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class VillagerListeners extends PluginDependent<EcoPlugin> implements Listener {
|
||||
@ -164,6 +168,8 @@ public class VillagerListeners extends PluginDependent<EcoPlugin> implements Lis
|
||||
|
||||
Map<EcoEnchant, Integer> toAdd = new HashMap<>();
|
||||
|
||||
Set<Enchantment> onItem = FastItemStack.wrap(result).getEnchantmentsOnItem(false).keySet();
|
||||
|
||||
double multiplier = 0.01;
|
||||
|
||||
for (EcoEnchant enchantment : enchantments) {
|
||||
@ -201,6 +207,19 @@ public class VillagerListeners extends PluginDependent<EcoPlugin> implements Lis
|
||||
anyConflicts.set(true);
|
||||
}
|
||||
});
|
||||
for (Enchantment enchant : onItem) {
|
||||
if (enchantment.conflictsWithAny(onItem)) {
|
||||
anyConflicts.set(true);
|
||||
}
|
||||
|
||||
if (enchant.conflictsWith(enchantment)) {
|
||||
anyConflicts.set(true);
|
||||
}
|
||||
|
||||
if (enchantment.conflictsWith(enchant)) {
|
||||
anyConflicts.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (anyConflicts.get()) {
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user