Skip to content

Commit

Permalink
Merge pull request #894 from TonytheMacaroni/main
Browse files Browse the repository at this point in the history
Check correct hand for `playeranimate` trigger
  • Loading branch information
Chronoken authored May 16, 2024
2 parents 7347d38 + c3d2a94 commit ba6c50b
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 ba6c50b

Please sign in to comment.