Solved How to remove a single Item from a stack in an inventory

Discussion in 'Plugin Development' started by justin_393, Apr 1, 2015.

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

    justin_393

    Title says it all. I'm trying to remove a single item from a player's Inventory. if I do p.getInventory().remove(item); it will remove the whole stack if they have more than 1. if I do p.getInventory().remove(item.getAmount() - 1); it won't remove anything. Anyone have an ideas?
     
  2. Offline

    Zombie_Striker

    • Test if Item.getAmount > 1
    • If so, set amount to getAmount - 1;
    • else, remove item/ Update Inv
     
  3. Offline

    justin_393

    Thanks!
     
  4. Offline

    Zombie_Striker

    If this worked, mark as [Solved] in the title.
     
Thread Status:
Not open for further replies.

Share This Page