Class GuiElementGroup

java.lang.Object
de.themoep.inventorygui.GuiElement
de.themoep.inventorygui.GuiElementGroup

public class GuiElementGroup
extends GuiElement
Represents a group of multiple elements
  • Constructor Details

    • GuiElementGroup

      public GuiElementGroup​(char slotChar, GuiElement... elements)
      A group of elements
      Parameters:
      slotChar - The character to replace in the gui setup string
      elements - The elements in this group
  • Method Details

    • getItem

      public org.bukkit.inventory.ItemStack getItem​(org.bukkit.entity.HumanEntity who, int slot)
      Description copied from class: GuiElement
      Get the item that is displayed by this element on a certain page
      Specified by:
      getItem in class GuiElement
      Parameters:
      who - The player who views the page
      slot - The slot to get the item for
      Returns:
      The ItemStack that is displayed as this element
    • setGui

      public void setGui​(InventoryGui gui)
      Description copied from class: GuiElement
      Set the gui this element belongs to
      Overrides:
      setGui in class GuiElement
      Parameters:
      gui - The GUI that this element is in
    • setSlots

      public void setSlots​(int[] slots)
      Description copied from class: GuiElement
      Set the ids of the slots where this element is assigned to
      Overrides:
      setSlots in class GuiElement
      Parameters:
      slots - An array of the slot ids where this element is displayed
    • addElement

      public void addElement​(GuiElement element)
      Add an element to this group
      Parameters:
      element - The element to add
    • addElements

      public void addElements​(GuiElement... elements)
      Add elements to this group
      Parameters:
      elements - The elements to add
    • addElements

      public void addElements​(Collection<GuiElement> elements)
      Add elements to this group
      Parameters:
      elements - The elements to add
    • getElement

      public GuiElement getElement​(int slot)
      Get the element in a certain slot
      Parameters:
      slot - The slot to get the element for
      Returns:
      The GuiElement in that slot or null
    • getElement

      public GuiElement getElement​(int slot, int pageNumber)
      Get the element in a certain slot on a certain page
      Parameters:
      slot - The slot to get the element for
      pageNumber - The number of the page that the gui is on
      Returns:
      The GuiElement in that slot or null
    • getElements

      public List<GuiElement> getElements()
      Get all elements of this group. This list is immutable, use addElement(GuiElement) and clearElements() to modify the elements in this group.
      Returns:
      An immutable list of all elements in this group
    • clearElements

      public void clearElements()
      Removes all elements in the group
    • setFiller

      public void setFiller​(org.bukkit.inventory.ItemStack item)
      Set the filler element for empty slots
      Parameters:
      item - The item for the filler element
    • setFiller

      public void setFiller​(GuiElement filler)
      Set the filler element for empty slots
      Parameters:
      filler - The item for the filler element
    • getFiller

      public GuiElement getFiller()
      Get the filler element
      Returns:
      The filler element
    • size

      public int size()
      Get the size of this group
      Returns:
      The amount of elements that this group has