Java 26.2
Damage Command
Target Selector
@pDistance
x rotation
y rotation
Team
Name
XP Level
Damage
@p
/damage @p 4 minecraft:generic
Damage context
The /damage command does more than subtract hearts: the damage type decides whether armor and enchantments apply, and the by/from context decides the death message and kill credit. Set the amount, the type and the context here instead of memorising the argument order.
Java 26.2
@p@p
/damage @p 4 minecraft:generic