Solved What number are the armor slots?

Discussion in 'Plugin Development' started by meguy26, Apr 4, 2015.

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

    meguy26

    So i am looping through a players inventory, and i need to know what the number armor slots are.
    Loop code:
    Code:
                    PlayerInventory inv = p.getInventory();
                    for(int i = 0; i < 36; i++){
                        ItemStack it = inv.getItem(i);
                                        
                    }
    I believe they are 33,34,35,36, but im not sure.
     
  2. Offline

    nverdier

    @meguy26 You can just use a foreach loop with inv.getContents()
     
  3. Offline

    meguy26

    @nverdier
    But how would i check if they are an armor slot, i need to know specifically what slot it is, like helmet, chestplate, etc.
     
  4. Offline

    nverdier

    @meguy26 Well what is the specific task you're trying to accomplish?
     
  5. Offline

    meguy26

    @nverdier
    Save the inventory, clear the players inv, reload inventory.
    (not in a YAML file)
     
  6. Offline

    nverdier

    @meguy26 Just use inv.getContents() and store that.
     
  7. Offline

    meguy26

    @nverdier
    yes, but how would I put know what armor to put on the player...

    EDIT:
    @nverdier
    Does getContents() include armor slots?
     
  8. Offline

    nverdier

    Nope.
     
    Protophite likes this.
  9. Offline

    meguy26

    ahh...
     
Thread Status:
Not open for further replies.

Share This Page