diff --git a/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java b/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java index 43c0dc25..f64799d3 100644 --- a/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java +++ b/src/main/java/net/Indyuce/mmoitems/comp/mmocore/MMOCoreHook.java @@ -10,6 +10,7 @@ import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute; import net.Indyuce.mmocore.api.player.stats.StatType; import net.Indyuce.mmocore.experience.Profession; import net.Indyuce.mmoitems.MMOItems; +import net.Indyuce.mmoitems.api.event.item.UntargetedWeaponUseEvent; import net.Indyuce.mmoitems.api.player.RPGPlayer; import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Attribute; import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Profession; @@ -62,6 +63,13 @@ public class MMOCoreHook implements RPGHandler, Listener { net.Indyuce.mmoitems.api.player.PlayerData.get(event.getPlayer()).getInventory().scheduleUpdate(); } + @EventHandler(ignoreCancelled = true) + public void stopAttacksWhenCasting(UntargetedWeaponUseEvent event) { + PlayerData playerData = PlayerData.get(event.getPlayerData().getUniqueId()); + if (playerData.isCasting()) + event.setCancelled(true); + } + /** * Removing this as it is causing issues when players log on for the first time. * Right after MMOCore loads the player data, MMOItems player data is not loaded yet