Class ItemUtils

java.lang.Object
me.hsgamer.hscore.bukkit.utils.ItemUtils

public final class ItemUtils extends Object
Methods on items
  • Method Details

    • giveItem

      public static void giveItem(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack... itemStack)
      Give the item to the player
      Parameters:
      player - the player
      itemStack - the item
    • getMatchedItemsInInventory

      public static List<org.bukkit.inventory.ItemStack> getMatchedItemsInInventory(org.bukkit.inventory.Inventory inventory, Predicate<org.bukkit.inventory.ItemStack> predicate, int maxAmount)
      Get the matched items in the inventory
      Parameters:
      inventory - the inventory
      predicate - the item predicate
      maxAmount - the max amount to get
      Returns:
      the matched items
      See Also:
    • removeItemInInventory

      public static void removeItemInInventory(org.bukkit.inventory.Inventory inventory, Collection<org.bukkit.inventory.ItemStack> items)
      Remove the items in the inventory
      Parameters:
      inventory - the inventory
      items - the items
    • removeItemInInventory

      public static void removeItemInInventory(org.bukkit.inventory.Inventory inventory, Predicate<org.bukkit.inventory.ItemStack> predicate, int amount)
      Remove the matched items in the inventory
      Parameters:
      inventory - the inventory
      predicate - the item predicate
      amount - the amount
      See Also:
    • getItemPredicate

      public static Predicate<org.bukkit.inventory.ItemStack> getItemPredicate(org.bukkit.inventory.ItemStack itemStack)
      Get the predicate of the item. This will check the item similarity
      Parameters:
      itemStack - the item
      Returns:
      the predicate
      See Also:
      • ItemStack.isSimilar(ItemStack)
    • isItemFullOnInventory

      public static boolean isItemFullOnInventory(org.bukkit.inventory.Inventory inventory, Collection<org.bukkit.inventory.ItemStack> items)
      Check if the items cannot be added to the inventory
      Parameters:
      inventory - the inventory
      items - the items
      Returns:
      true if the items cannot be added to the inventory
    • isItemFullOnInventory

      public static boolean isItemFullOnInventory(org.bukkit.inventory.Inventory inventory, org.bukkit.inventory.ItemStack item)
      Check if the item cannot be added to the inventory
      Parameters:
      inventory - the inventory
      item - the item
      Returns:
      true if the item cannot be added to the inventory
    • createItemCheckSession

      public static ItemUtils.ItemCheckSession createItemCheckSession(org.bukkit.inventory.Inventory inventory, Predicate<org.bukkit.inventory.ItemStack> predicate, int maxAmount)
      Create a new ItemUtils.ItemCheckSession that check the inventory for the items that match the predicate
      Parameters:
      inventory - the inventory
      predicate - the item predicate
      maxAmount - the max amount to check
      Returns:
      the ItemUtils.ItemCheckSession
      See Also: