Check if an Inventory is Full

Discussion in 'Plugin Development' started by ChrisixStudios, Nov 4, 2012.

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

    ChrisixStudios

    Is there an easy way to check if an Inventory is full? Or even better check if it can fit the ItemStack I want to put in the Inventory? Thanks for any help :)
     
  2. Offline

    gomeow

    Maybe iterate through all slots, if it isn't null, and it's the last iteration, do what you want to do
     
  3. Offline

    Sheepii

    Code:
    p.getInventory().contains(Material.AIR)
    //then it's not full.
     
    
     
  4. Offline

    Ranzdo

  5. Offline

    Sagacious_Zed Bukkit Docs

    Inventory has a firstEmpty method that should return -1 if the inventory is completely full.
     
Thread Status:
Not open for further replies.

Share This Page