So I cam working with a wand and I use action.left_click_air, and left_click_block with a stick in hand to cast a spell. The problem is if you are to close to the thing you're casting at, like a sheep, and just hit it with the stick, it does not cast the spell. There is no action for player hit or anything but it is the player interact, so how do I tell if the player hit something as oppose to just clicking in the air/block? So I need click on block/air/entity basically, not just block/air.
Listen for EntityDamageByEntity events, check the item in hand of the damager entity if it's a Player?
Listen for EntityDamgeEvent then getDamager see if it's a player, then get the item in the players hand and continue your code.