Items not removing from inventory

Discussion in 'Plugin Development' started by Worthless_Hobo, Sep 29, 2014.

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

    Worthless_Hobo

    Im having a slight problem with rotten flesh not disappearing from my inventory when I have the exact amount that it is suppose to remove. Here is my code:
    Code:java
    1. if(player.getGameMode() != GameMode.CREATIVE){
    2. player.getInventory().removeItem(new ItemStack[] { new ItemStack(Material.ROTTEN_FLESH, 32) });
    3. player.updateInventory();
    4. }

    I have absolutely no idea why it doesnt work with rotten flesh because the same code works fine with bone.
     
  2. Offline

    Zombieghost_391

    Code:java
    1. if (!p.getGameMode().equals(GameMode.CREATIVE) && p.getInventory().contains(Material.ROTTEN_FLESH)){
    2. p.getInventory().remove(Material.ROTTEN_FLESH);
    3. }
     
  3. Offline

    Worthless_Hobo

    I already checked for the rotten flesh and it works fine, like I said the same code works for bone but not rotten flesh.
     
  4. Offline

    MineStein

    Worthless_Hobo I don't know why this happens, but it has occurred during the development of some of my plugins. It doesn't happen all the time though.
     
  5. Offline

    Worthless_Hobo

    I noticed it with my iron sword as well but I figured a way around it, this time it wont work though, if I switch the rotten flesh to another item it just turns back almost instantly.
     
Thread Status:
Not open for further replies.

Share This Page