Class GUISection

java.lang.Object
de.placeblock.betterinventories.content.GUISection
All Implemented Interfaces:
Sizeable
Direct Known Subclasses:
GUIItem, GUIPane

public abstract class GUISection extends Object implements Sizeable
A GUISection is the most basic element that can be put inside GUIs.
  • Field Details

    • minSize

      protected Vector2d minSize
      The minimum size of the Section
    • maxSize

      protected Vector2d maxSize
      The maximum size of the Section
  • Constructor Details

    • GUISection

      protected GUISection(GUI gui, Vector2d size, Vector2d minSize, Vector2d maxSize)
      Creates a new GUISection
      Parameters:
      gui - The GUI
      size - The size of the Section
      minSize - The minimum size of the Section
      maxSize - The maximum size of the Section
  • Method Details

    • setSize

      public void setSize(Vector2d vector2d)
      Sets the size
      Parameters:
      vector2d - The new size
    • render

      public abstract List<org.bukkit.inventory.ItemStack> render()
      Renders the Section on a list
      Returns:
      The List
    • search

      public abstract void search(SearchData searchData)
      Searches the GUISection recursively. The SearchData is filled recursively.
      Parameters:
      searchData - The searchData that contains all needed information
    • slotToVector

      public Vector2d slotToVector(int slot)
      Converts a slot to a vector based on the width of this Section
      Parameters:
      slot - The slot to be converted
      Returns:
      The calculated vector or null if the size of this Section is 0
    • getEmptyContentList

      public <T> List<T> getEmptyContentList(Class<T> clazz)
      Returns a List with the amount of slots in this Section filled with null values.
      Type Parameters:
      T - The type of the List
      Parameters:
      clazz - The class of the type of the List
      Returns:
      The List filled with null values
    • vectorToSlot

      public int vectorToSlot(Vector2d position)
      Converts a position to a slot based on the width of this Section
      Parameters:
      position - The position to be converted
      Returns:
      The calculated slot
    • getSlots

      public int getSlots()
      Returns:
      The slots of this Section
    • getHeight

      public int getHeight()
      Returns:
      The height of this Section
    • getWidth

      public int getWidth()
      Returns:
      The width of this Section
    • onItemClick

      public abstract void onItemClick(ClickData data)
      Called when a user clicks on an item. Usually after this method one of the add/remove/amount methods is called.
      Parameters:
      data - The clickdata
    • onItemAdd

      public abstract boolean onItemAdd(Vector2d position, org.bukkit.inventory.ItemStack itemStack)
      Called when an item is added to an empty slot
      Parameters:
      position - The relative position of the slot
      itemStack - The itemstack that was added
      Returns:
      Whether this action should be cancelled.
    • onItemRemove

      public abstract org.bukkit.inventory.ItemStack onItemRemove(Vector2d position)
      Called when an item is removed from an empty slot
      Parameters:
      position - The relative position of the slot
      Returns:
      The removed Item, if any
    • onItemAmount

      public abstract boolean onItemAmount(Vector2d position, int amount)
      Called when the amount of an item in a slot changes
      Parameters:
      position - The relative position of the slot
      amount - The new amount of the item
      Returns:
      Whether this action should be cancelled.