Solved Remove item from hand

Discussion in 'Plugin Development' started by YoFuzzy3, Dec 15, 2012.

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

    YoFuzzy3

    This is driving me a bit crazy. I've tried setting the item to air and removing the item in several ways but none seem to work. Someone show me the correct way?
     
  2. Offline

    tommycake50

    set it to null maybe?
    or itemstack.setAmount(0);
    etc,
     
  3. Offline

    YoFuzzy3

    Setting it to 0 does nothing, setting it to null throws an NPE. I tried updateInventory() as well.
     
  4. Offline

    CeramicTitan

    p.setItemInHand(null); || p.setItemInHand(new ItemStack(Material.AIR, 1));
     
  5. Offline

    tommycake50

    it would be null i think :/
     
  6. Offline

    drunkenmeows

    Code:java
    1.  
    2. //clear HeldItemSlot from players inventory.
    3. p.getInventory().clear(p.getInventory().getHeldItemSlot());
    4.  


    This works for me.
     
    YoFuzzy3 likes this.
  7. Offline

    YoFuzzy3

    Forgot about the thread... but yes that works, thank you.
     
Thread Status:
Not open for further replies.

Share This Page