Empty Slot

Discussion in 'Plugin Development' started by np98765, Sep 18, 2012.

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

    np98765

    Hey there,

    How would I set an inventory slot as empty? I've tried setting the item to air, the ID to 0, the item to null... Nothing seems to work. I know it will be a really simple solution. >.<

    For example, if I want to get a value from a config and save it as "i", and then check if i is "0"...

    Code:JAVA
    1.  
    2. ItemStack i = new ItemStack(0);
    3. String getSlot = getConfig().getString("items." + slot);
    4.  
    5. if (getSlot.equals("0")) {
    6. //Set i to nothing
    7. }
    8.  
     
  2. Offline

    JazzaG

    This works perfectly for me:

    Code:
    player.getInventory().getItem(int index).setTypeId(0);
    player.getInventory().getItem(int index).setType(Material.AIR);
    
     
Thread Status:
Not open for further replies.

Share This Page