Class InventoryManager

java.lang.Object
studio.magemonkey.codex.mccore.items.InventoryManager

public class InventoryManager extends Object
Manages creating inventories and checking if the inventory is for a particular purpose using keys attached to the inventory holder. An example usage of this would be a custom shop inventory where functionality is attached to that specific inventory. Creating the inventory with a key, then checking on events for the matching key lets you easily apply functionality to only the shop inventories.
  • Constructor Details

    • InventoryManager

      public InventoryManager()
  • Method Details

    • createInventory

      public static org.bukkit.inventory.Inventory createInventory(String key, int rows, String title)
      Creates a new inventory marked with the given key
      Parameters:
      key - key to mark the inventory with
      rows - number of rows in the inventory
      title - title for the inventory
      Returns:
      the created inventory
    • isMatching

      public static boolean isMatching(org.bukkit.inventory.Inventory inventory, String key)
      Checks whether the given inventory matches the given key
      Parameters:
      inventory - inventory to check
      key - key to check against
      Returns:
      true if matches, false otherwise