Skip to content

Commit

Permalink
Check correct hand
Browse files Browse the repository at this point in the history
  • Loading branch information
TonytheMacaroni committed May 16, 2024
1 parent 7347d38 commit c3d2a94
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.event.player.PlayerAnimationEvent;

import com.nisovin.magicspells.util.Name;
Expand Down Expand Up @@ -48,7 +49,11 @@ public void onAnimate(PlayerAnimationEvent event) {
if (!canTrigger(caster)) return;

if (!items.isEmpty()) {
ItemStack item = caster.getInventory().getItemInMainHand();
ItemStack item = caster.getInventory().getItem(switch (event.getAnimationType()) {
case ARM_SWING -> EquipmentSlot.HAND;
case OFF_ARM_SWING -> EquipmentSlot.OFF_HAND;
});

MagicItemData itemData = MagicItems.getMagicItemDataFromItemStack(item);
if (itemData == null || !contains(itemData)) return;
}
Expand Down

0 comments on commit c3d2a94

Please sign in to comment.