Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

get free player inventory slots spigot

public int getFreeSlots(Player player) {
    int freeslots = 0;
    for (ItemStack it : player.getInventory().getContents()) {
        if (it == null || it.getType() == Material.AIR) {
            freeslots++;
        }
    }
    freeslots = freeslots - 5; // subtract shield and armor

    return freeslots;
}
 
PREVIOUS NEXT
Tagged: #free #player #inventory #slots #spigot
ADD COMMENT
Topic
Name
2+2 =