Thorns

Thorns is an armor enchantment that causes attackers to be damaged when they deal damage to the wearer.

This enchantmeant deals  chance of inflicting - (or   if Level > 10) damage on anyone who attacks the wearer, whether by melee attack, arrow, or other projectile.

Thorns applies a durability penalty to the armor. It reduces durability by an additional 3 points when inflicting damage. If Thorns is present on multiple pieces of armor, each piece will separately inflict damage on the attacker, but the Thorns durability penalties for all of them will be applied to just one of the pieces, chosen randomly.

Thorns III can be obtained only by using an anvil to combine two Thorns II enchantments, or by combining the enchantment from a book obtained via trading with a villager.

Thorns can be applied to a non-armor item only by using commands or a third-party tool. When such an item is held in either hand, an attacker will suffer damage according to the formula above but the durability penalty will not be applied.