From f1b6b33ef61324c5f67cc9ac4177cd0a9684f4a7 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Thu, 15 Apr 2021 14:01:21 +0100 Subject: [PATCH] Optimised armor listener --- .../ecoenchants/enchantments/util/WatcherTriggers.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java index 2e6cd047..ccd6759c 100644 --- a/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java +++ b/eco-core/core-plugin/src/main/java/com/willfp/ecoenchants/enchantments/util/WatcherTriggers.java @@ -10,7 +10,6 @@ import com.willfp.eco.core.integrations.mcmmo.McmmoManager; import com.willfp.eco.util.TridentUtils; import com.willfp.ecoenchants.EcoEnchantsPlugin; import com.willfp.ecoenchants.enchantments.EcoEnchant; -import com.willfp.ecoenchants.enchantments.EcoEnchants; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.*; @@ -580,7 +579,7 @@ public class WatcherTriggers extends PluginDependent implements Listener { Player player = event.getPlayer(); - this.getPlugin().getScheduler().runLater(() -> EcoEnchants.values().forEach(enchant -> { + this.getPlugin().getScheduler().runLater(() -> EnchantChecks.getEnchantsOnArmor(player).forEach((enchant, integer) -> { if (!enchant.isEnabled()) { return; } @@ -589,8 +588,7 @@ public class WatcherTriggers extends PluginDependent implements Listener { return; } - int level = EnchantChecks.getArmorPoints(player, enchant); - enchant.onArmorEquip(player, level, event); + enchant.onArmorEquip(player, integer, event); }), 1); }