Item item/enchant

Item Enchant

Gets, sets, checks, or removes an enchantment on an ItemStack.

Note: Uses the Paper Registry API — enchantment names are lowercase (e.g. "sharpness", "protection", "unbreaking"). SET and REMOVE return a cloned item; GET and HAS return the original unchanged.

Inputs

NameTypeOptionalDescription
item item_stack The source ItemStack.
enchantment string Enchantment name (e.g. sharpness, unbreaking).
level number Enchantment level (SET only).

Outputs

NameTypeDescription
item item_stack Modified clone (SET/REMOVE) or unchanged item (GET/HAS).
level number Current enchantment level (GET), or 0 if not present.
has boolean True if the enchantment is present (HAS).

Properties

KeyTypeDefaultDescription
op string "GET" GET, SET, REMOVE, or HAS.
enchantment string "sharpness" Enchantment
level number 1 Level

Examples

Give a Sharpness V sword

Create a sword and enchant it.

  1. Create Item (DIAMOND_SWORD) → Item Enchant
  2. Set op=SET, enchantment=sharpness, level=5
  3. Item Enchant → item → Player Give Item