diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java index 185733a0..980102ac 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/itemtypes/Spell.java @@ -56,19 +56,20 @@ public abstract class Spell extends EcoEnchant { public void onUseEventHandler(PlayerInteractEvent event) { Player player = event.getPlayer(); - if(!leftClickItems.contains(player.getInventory().getItemInMainHand().getType())) { - if(!(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK))) - return; - } else { - if(!(event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK))) - return; - } - if(runningSpell.contains(player.getUniqueId())) return; - runningSpell.add(player.getUniqueId()); Bukkit.getScheduler().runTaskLater(EcoEnchantsPlugin.getInstance(), () -> runningSpell.remove(player.getUniqueId()), 5); + if(leftClickItems.contains(player.getInventory().getItemInMainHand().getType())) { + if(!(event.getAction().equals(Action.LEFT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_BLOCK))) { + return; + } + } else { + if(!(event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.RIGHT_CLICK_BLOCK))) { + return; + } + } + if(!EnchantChecks.mainhand(player, this)) return;