Add an ItemStack in an inventory?

Discussion in 'Plugin Development' started by okami35, Dec 17, 2011.

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


    In my last plugin, i would like to add an itemstack in a player's inventory.(like a give)
    For the moment, I just have:

    ItemStack is = new ItemStack(id, nbre);
    Do you have any ideas?

    thank you for your help.
  2. Offline


    Assuming you already have your Player object (named player for this example), the following would work:

    HashMap<Integer, ItemStack> residual = player.getInventory().addItem(is);
    The 'residual' object contains all the items that couldn't be added to the player's inventory

    The method was in the javadocs, which I highly suggest looking over.
  3. Offline


    For reference;JavaDoc link:
Thread Status:
Not open for further replies.

Share This Page