Error adding enchants

Discussion in 'Plugin Development' started by p1xlblad3, May 14, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    p1xlblad3

    So I'm working on a kit plugin for a server. I want to add enchants, so I did:
    Code:
    player.getInventory().addItem(new ItemStack(Material.IRON_SWORD, 1).addEnchantment(Enchantment.DAMAGE_ALL, 1));
    But I get this error every time:
    Can someone tell me what I am doing wrong?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @p1xlblad3 You can't do that in a single line.
    Make the item, add the enchantment, then add it to the inventory.
     
Thread Status:
Not open for further replies.

Share This Page