I have been making custom items a lot on my server but they rely on using attacker's tool when I would want to use something like event-item instead.
The issue with attacker's tool is if someone shoots a bow and then switch to hold the custom item when the arrow hits then the custom item will trigger as if its the thing that caused the damage. I am seeing this again in the script below which crashed my server because when it triggers the lightning it just infinitely loops because that lightning causes damage too. So whats a different way to do it so I can detect the item itself not just what they are holding. the docs show that you cannot use event-item, why is that?
attacker's tool is mace
if name of attacker's tool is "&bLightning":
send "&ee" to attacker
loop players in radius 5 of attacker:
gamemode of loop-player is not spectator
strike lightning effect at loop-player
make attacker damage loop-player by damage/2
set damage to damage/2```