Add item

Discussion in 'Plugin Development' started by Snakeruler, Mar 10, 2011.

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


    What's wrong with this code?

    player.getInventory().addItem(new ItemStack(Block.COBBLESTONE, 4, 2));
    The player class is correct and everything, it just seems to underline 'addItem' bit :/
  2. Offline


    That underline is there for a reason, when you point your mouse there Eclipse will tell you more ;)

    From what I see COBBLESTONE is a Material, not a Block value.
  3. Offline


    I get the error:

    The method addItem(ItemStack...) in the type Inventory is not applicable for the arguments (ItemStack)
  4. Offline


    Instead of BLOCK.Cobblestone try the real id.
  5. Offline


    I still get the same error :/
  6. Offline

    Joshua Neicho

    player.getInventory().addItem(new ItemStack(Material.COBBLESTONE, 4, 2));
    try that I'm a noob a bukkit so sorry if it doesn't work
  7. Offline


    I think you are trying to add net.minecraft.server.ItemStack, instead of org.bukkit.inventory.ItemStack.
Thread Status:
Not open for further replies.

Share This Page