Solved Giving player items

Discussion in 'Plugin Development' started by Fl1pzta, Jul 10, 2013.

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

    Fl1pzta

    If I give a player an ItemStack like so:
    p.getInventory.add(new ItemStack(Material.MUSHROOM_SOUP, 1));

    If I do that to a full inventory, will it automatically drop the item on the ground? If not how would I go about giving an Array of ItemStack and checking if each ItemStack can fit in a player's inventory(including a cooresponding stackable items check)?
     
  2. Offline

    andf54

    If you look at the add(items...) method, then it returns a HashMap containing the items that didn't fit. It's a hash map, because you can add(item1, item2, ...). Do map.get(0) if you add just one item.
     
  3. Offline

    Fl1pzta

    Yeah, I kept seeing it returned HashMap. Thanks man
     
Thread Status:
Not open for further replies.

Share This Page