Cant Delete Item in hand.

Discussion in 'Plugin Development' started by Zaphyk, Sep 7, 2013.

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

    Zaphyk

    I´ve tried this code but i cant still destroy the item in my hand when its durability its under a certain number.
    I have this code so far.

    if (player.getInventory().getItemInHand().getDurability() >= 1541){
    player.getInventory().removeItem(player.getInventory().getItemInHand());
    player.updateInventory();

    I know its simply but it still does not work for me.
     
  2. Offline

    AstramG

    I forget what you need to do, it's stupid how that doesn't work. But please next time post in the plugin development section instead of this subforum which is for statuses of plugins.
     
  3. Offline

    Wundark

    Code:java
    1. player.setItemInHand(null);
    2.  
    3. OR
    4.  
    5. player.setItemInHand(new ItemStack(0));
     
  4. Offline

    Jade

    Moved to correct section.
     
  5. Offline

    Zaphyk

    Thank you
     
  6. Offline

    thalac

    Code:java
    1. p.getInventory().remove(p.getItemInHand());
     
Thread Status:
Not open for further replies.

Share This Page