Minecraft wiki entry for Death_messages, associated text: <player> was killed trying to hurt <player/mob>
Appears when the player is killed because they hurt a guardian, elder guardian, or a player or mob wearing armor enchanted with Thorns.
<player> was killed by <item> trying to hurt <player/mob>
Appears when the player is killed because they hurt a guardian, elder guardian, or a player or mob wearing armor enchanted with Thorns and holding a renamed item.