give enchanted sword minecraft code example

Example 1: maxed diamond sword command

/give @p diamond_sword{Enchantments:[{id:sharpness,lvl:5},{id:knockback,lvl:2},{id:fire_aspect,lvl:2},{id:looting,lvl:3},{id:sweeping,lvl:3},{id:unbreaking,lvl:3},{id:mending,lvl:1}]} 1

Example 2: how to give enchanted armor

1.13+
/give @p (armour_piece){Enchantments:[{id:(name),lvl:(lvl_num)},
{id:(name),lvl:(lvl_num)},{id:(name),lvl:(lvl_num)},{id:(name),lvl:(lvl_num)},
{id:(name),lvl:(lvl_num)},{id:(name),lvl:(lvl_num)},{id:(name),lvl:1}]} 1

1.9+
/give @p (armour_piece) 1 0 {ench:[{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)}]}

pre 1.9
/give @p (armour_piece) 1 0 {ench:[{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)},
{id:(id_num),lvl:(lvl_num)},{id:(id_num),lvl:(lvl_num)}]}

Tags:

Misc Example