Minecraft wiki entry for Sword, associated text: Pressing attack while holding a sword inflicts damage on both mobs and other players. Upon damaging a mob or player, the sword's durability decreases by 1.