Interface Inventory


public interface Inventory
The `Inventory` interface defines the structure and behavior of inventory-related operations.

Documentation: Inventory documentation

This class encapsulates information about an inventory, including its size, buttons, patterns, and associated requirements.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Determines whether the player's inventory should be cleared upon closing the inventory.
    void
    closeInventory(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault)
    Closes the inventory for a player.
    Returns a collection of buttons present in the inventory.
    <T extends Button>
    List<T>
    getButtons(Class<T> type)
    Returns a list of buttons of a specific type.
    Returns the configuration file associated with the inventory.
    Returns the name of the file associated with the inventory.
    fr.maxlego08.menu.MenuItemStack
    Returns the item stack used to fill empty slots in the inventory.
    int
    getMaxPage(Collection<Pattern> patterns, org.bukkit.entity.Player player, Object... objects)
    Returns the maximum number of pages for the inventory.
    int
    getMaxPage(org.bukkit.entity.Player player, Object... objects)
    Deprecated.
    Returns the name of the inventory.
    fr.maxlego08.menu.api.requirement.Requirement
    Returns the requirement for opening the inventory.
    Returns the item that can be used to open the inventory.
    Returns a collection of patterns associated with the inventory.
    org.bukkit.plugin.Plugin
    Returns the plugin from which the inventory originates.
    int
    Returns the interval for updating buttons in the inventory.
    fr.maxlego08.menu.zcore.utils.inventory.InventoryResult
    openInventory(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault)
    Opens the inventory for a player and returns the result of the operation.
    void
    postOpenInventory(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault)
    Performs post-opening actions for the inventory.
    int
    Returns the size of the inventory.
    sortButtons(int page, Object... objects)
    Sorts the buttons based on the current page and additional elements.
    sortPatterns(Pattern pattern, int page, Object... objects)
    Sorts the pattern buttons based on the current page and additional elements.
  • Method Details

    • size

      int size()
      Returns the size of the inventory.
      Returns:
      The size of the inventory.
    • getName

      String getName()
      Returns the name of the inventory.
      Returns:
      The name of the inventory.
    • getFileName

      String getFileName()
      Returns the name of the file associated with the inventory.
      Returns:
      The file name.
    • getButtons

      Collection<Button> getButtons()
      Returns a collection of buttons present in the inventory.
      Returns:
      A collection of buttons.
    • getPatterns

      Collection<Pattern> getPatterns()
      Returns a collection of patterns associated with the inventory.
      Returns:
      A collection of patterns.
    • getButtons

      <T extends Button> List<T> getButtons(Class<T> type)
      Returns a list of buttons of a specific type.
      Type Parameters:
      T - The button type.
      Parameters:
      type - The class type of the button.
      Returns:
      A list of buttons with the specified type.
    • getPlugin

      org.bukkit.plugin.Plugin getPlugin()
      Returns the plugin from which the inventory originates.
      Returns:
      The plugin.
    • getMaxPage

      @Deprecated int getMaxPage(org.bukkit.entity.Player player, Object... objects)
      Deprecated.
      Returns the maximum number of pages for the inventory.
      Parameters:
      player - The player for whom the page count is determined.
      objects - Additional elements.
      Returns:
      The maximum number of pages.
    • getMaxPage

      int getMaxPage(Collection<Pattern> patterns, org.bukkit.entity.Player player, Object... objects)
      Returns the maximum number of pages for the inventory.
      Parameters:
      patterns - Pattern list
      player - The player for whom the page count is determined.
      objects - Additional elements.
      Returns:
      The maximum number of pages.
    • sortButtons

      List<Button> sortButtons(int page, Object... objects)
      Sorts the buttons based on the current page and additional elements.
      Parameters:
      page - The current page.
      objects - Additional elements.
      Returns:
      A list of sorted buttons.
    • sortPatterns

      List<Button> sortPatterns(Pattern pattern, int page, Object... objects)
      Sorts the pattern buttons based on the current page and additional elements.
      Parameters:
      pattern - The pattern
      page - The current page.
      objects - Additional elements.
      Returns:
      A list of sorted buttons.
    • openInventory

      fr.maxlego08.menu.zcore.utils.inventory.InventoryResult openInventory(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault)
      Opens the inventory for a player and returns the result of the operation.
      Parameters:
      player - The player opening the inventory.
      inventoryDefault - The inventory to be opened.
      Returns:
      The result of the inventory opening.
    • postOpenInventory

      void postOpenInventory(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault)
      Performs post-opening actions for the inventory.
      Parameters:
      player - The player for whom post-opening actions are performed.
      inventoryDefault - The default inventory object.
    • closeInventory

      void closeInventory(org.bukkit.entity.Player player, fr.maxlego08.menu.inventory.inventories.InventoryDefault inventoryDefault)
      Closes the inventory for a player.
      Parameters:
      player - The player closing the inventory.
      inventoryDefault - The inventory to be closed.
    • getFillItemStack

      fr.maxlego08.menu.MenuItemStack getFillItemStack()
      Returns the item stack used to fill empty slots in the inventory.
      Returns:
      The fill item stack.
    • getUpdateInterval

      int getUpdateInterval()
      Returns the interval for updating buttons in the inventory.
      Returns:
      The update interval.
    • getFile

      File getFile()
      Returns the configuration file associated with the inventory.
      Returns:
      The configuration file.
    • cleanInventory

      boolean cleanInventory()
      Determines whether the player's inventory should be cleared upon closing the inventory.
      Returns:
      True if the player's inventory should be cleaned, false otherwise.
    • getOpenRequirement

      fr.maxlego08.menu.api.requirement.Requirement getOpenRequirement()
      Returns the requirement for opening the inventory.
      Returns:
      The opening requirement.
    • getOpenWithItem

      OpenWithItem getOpenWithItem()
      Returns the item that can be used to open the inventory. (Left or rick click)
      Returns:
      The OpenWithItem