Commands/enchant

Adds an enchantment to a player's selected item, subject to the same

restrictions as an anvil.

Syntax

 * Java Edition


 * Bedrock Edition

Arguments
(BE: )
 * Specifies the (s). Must be a player name, target selector or a UUID.
 * Permits entities other than players.

(BE:  or  )
 * Specifies the enchantment to be added to the item held by the target. Must be a valid enchantment ID.

(BE: )
 * Specifies the enchantment level. Must be at least 1 and not greater than the maximum level for the specified enchantment. If not specified, defaults to 1.

Result
Fails if arguments are not specified correctly, if  fails to resolve to one or more online players, if the enchantment is not valid for the item, or if the enchantment conflicts with current enchantments (for example, "Piercing" cannot be given to a crossbow which already has "Multishot", and "Sharpness III" cannot be given to a sword which already has "Sharpness I").

On success, adds the specified enchantment to the item held by the target.

Examples

 * To give the Infinity enchantment to all players holding a bow:
 * To enchant the executing player's held sword with Sharpness 5:
 * To enchant the executing player's held sword with Sharpness 5: