Class InventoryUtil


  • public class InventoryUtil
    extends java.lang.Object
    Collection of methods relating to Inventory management
    • Constructor Summary

      Constructors 
      Constructor Description
      InventoryUtil()  
    • Method Summary

      Modifier and Type Method Description
      static boolean containsItem​(org.bukkit.inventory.Inventory inventory, org.bukkit.inventory.ItemStack itemStack, int quantity)
      Checks if the inventory contains the number of items given
      static boolean removeItem​(org.bukkit.inventory.Inventory inventory, org.bukkit.inventory.ItemStack itemStack, int quantity)
      Remove items in the inventory up to the amount given.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InventoryUtil

        public InventoryUtil()
    • Method Detail

      • containsItem

        public static boolean containsItem​(org.bukkit.inventory.Inventory inventory,
                                           org.bukkit.inventory.ItemStack itemStack,
                                           int quantity)
        Checks if the inventory contains the number of items given
        Parameters:
        inventory - the inventory
        itemStack - the itemstack
        quantity - the amount
        Returns:
        if the inventory contains the quantity of itemstack
      • removeItem

        public static boolean removeItem​(org.bukkit.inventory.Inventory inventory,
                                         org.bukkit.inventory.ItemStack itemStack,
                                         int quantity)
        Remove items in the inventory up to the amount given. Starts at the bottom of the inventory and works it's way up

        Will return a true or false depending on if all the items were removed

        Parameters:
        inventory - the inventory
        itemStack - the itemstack
        quantity - the quantity
        Returns:
        if able to remove all the items