Solved Bug removing Items from a players inventory

Discussion in 'Plugin Development' started by nuno1212sss, Apr 9, 2014.

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

    nuno1212sss

    Hi When I try to remove a stack of items and the player has 2 stacks of the item required it removes the 2 stacks....!
    Please help me!
    Code:
    if (p.getInventory().contains(im)) {
                        p.getInventory().remove(im);
                        p.updateInventory();
    }
     
  2. Offline

    Onlineids

    removeAll(im)
     
  3. Offline

    nuno1212sss

  4. Offline

    Garris0n

    What is im?
     
  5. Offline

    nuno1212sss

    Garris0n ItemStack found out by myself
     
  6. Offline

    Onlineids

    Post what you did so when others have the same error.
     
  7. Offline

    nuno1212sss

    Code:
    p.getInventory().removeItem(new ItemStack(Material.EGG, 1));
    
    This will only remove 1 item even if the player has more than 1.
     
Thread Status:
Not open for further replies.

Share This Page