On my constant tirade of making a PvP map so far, I've successfully made or modified custom death message systems for arrows and falling to death with help from here, but I also want a system in which can detect melee deaths via swords and axes to create custom death messages there as well.
I figured that the same system I'm currently using for arrows could work similarly for swords, minor exception in that I'd need to create tags to verify if the attack was a sword or an axe.
Is there a way, however, to check if a player's SelectedItem
is in a certain tag (eg. I put all the swords into one called #swords
)? Or do I need to set up a function for each sword rather than just testing for swords in general?
In case it's needed, here's how the system works generally;
- Check for player death via something other than an arrow (drowning, burning from lava/fire, and fall damage are non-existent, and mobs are turned off, and the gamemode is Adventure which prevents block placement, therefore no other damage types can be made)
- Run "generic" kill check, looking for if it's a sword or an axe <-- This is where the search would be looked for
- Check for enchantments/tags on the sword/axe that's found