Add item

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

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

    Snakeruler

    What's wrong with this code?

    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

    Plague

    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

    Snakeruler

    I get the error:

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

    Bubby4j

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

    Snakeruler

    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

    nickguletskii

    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