Solved [Inventory] Manipulation

Discussion in 'Plugin Development' started by girardcome, Jul 30, 2014.

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

    girardcome

    Hey there! I would like someone who can tell me how can i fill all empty slots remaining with an item from an inventory?
    I did that :
    Code:java
    1. for(int i = 0; i<54; i++){
    2. kitselect.setItem(i, glass);
    3. }

    But it's not what i really want^^ The inventory is kinda of GUI, and there are already items on it, and after item are placed on the inventory, then it will fill all empty slot with another item.
     
  2. Offline

    techboy291

    You can either use
    Code:
    kitselect.getItem(i) == null
    or
    Code:
    kitselect.getItem(i).getType().equals(Material.AIR)
    to check if a slot is empty. I can never remember if it's null or air when it's empty.
     
  3. Offline

    girardcome

    Oh great! That works :p
     
    techboy291 likes this.
Thread Status:
Not open for further replies.

Share This Page