Remove renamed items from inventory

Discussion in 'Plugin Development' started by MisterErwin, Mar 22, 2013.

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

    MisterErwin

    Hello together,

    how can I removed renamed items from a player?

    This code won't work:
    Code:
    p.getInventory().removeItem(new ItemStack(Material.TNT, 1));
    Thanks,
    MisterErwin
     
  2. Offline

    TheUpdater

    get the name of the item and if it ecuals to like superfood then it removes use meta data
     
    MisterErwin likes this.
  3. Offline

    MisterErwin

    Thanks,

    but I'm checking the contents for an Item ID ;)
     
  4. Offline

    ZeusAllMighty11

    Code:
    p.getInventory().removeItem(new ItemStack(Material.TNT, 1));
    
    You created a new itemstack, which will never be equal to an itemstack with item meta.
     
  5. Offline

    Wolftic

    check if the item has an ItemMeta and then remove it.
     
  6. Offline

    Codisimus

    This would remove an unnamed enchanted item.
     
  7. Offline

    Wolftic

    Check if the item has an ItemMeta & DisplayName and then remove it ;)
     
    Codisimus likes this.
Thread Status:
Not open for further replies.

Share This Page