Package de.themoep.inventorygui
Class GuiElementGroup
java.lang.Object
de.themoep.inventorygui.GuiElement
de.themoep.inventorygui.GuiElementGroup
Represents a group of multiple elements. Will be left-aligned by default.
-
Nested Class Summary
Nested classes/interfaces inherited from class de.themoep.inventorygui.GuiElement
GuiElement.Action, GuiElement.Click
-
Field Summary
Fields inherited from class de.themoep.inventorygui.GuiElement
gui, slots
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addElement
(GuiElement element) Add an element to this groupvoid
addElements
(GuiElement... elements) Add elements to this groupvoid
addElements
(Collection<GuiElement> elements) Add elements to this groupvoid
Removes all elements in the groupGet the alignment of the elements in this groupgetElement
(int slot) Get the element in a certain slotgetElement
(int slot, int pageNumber) Get the element in a certain slot on a certain pageGet all elements of this group.Get the filler elementorg.bukkit.inventory.ItemStack
getItem
(org.bukkit.entity.HumanEntity who, int slot) Get the item that is displayed by this element on a certain pagevoid
setAlignment
(GuiElementGroup.Alignment alignment) Set the alignment of the elements in this groupvoid
setFiller
(GuiElement filler) Set the filler element for empty slotsvoid
setFiller
(org.bukkit.inventory.ItemStack item) Set the filler element for empty slotsvoid
setGui
(InventoryGui gui) Set the gui this element belongs tovoid
setSlots
(int[] slots) Set the ids of the slots where this element is assigned toint
size()
Get the size of this groupMethods inherited from class de.themoep.inventorygui.GuiElement
getAction, getGui, getSlotChar, getSlotIndex, getSlotIndex, getSlots, setAction
-
Constructor Details
-
GuiElementGroup
A group of elements- Parameters:
slotChar
- The character to replace in the gui setup stringelements
- 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 classGuiElement
- Parameters:
who
- The player who views the pageslot
- The slot to get the item for- Returns:
- The ItemStack that is displayed as this element
-
setGui
Description copied from class:GuiElement
Set the gui this element belongs to- Overrides:
setGui
in classGuiElement
- 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 classGuiElement
- Parameters:
slots
- An array of the slot ids where this element is displayed
-
addElement
Add an element to this group- Parameters:
element
- The element to add
-
addElements
Add elements to this group- Parameters:
elements
- The elements to add
-
addElements
Add elements to this group- Parameters:
elements
- The elements to add
-
getElement
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
Get the element in a certain slot on a certain page- Parameters:
slot
- The slot to get the element forpageNumber
- The number of the page that the gui is on- Returns:
- The GuiElement in that slot or
null
-
getElements
Get all elements of this group. This list is immutable, useaddElement(GuiElement)
andclearElements()
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
Set the filler element for empty slots- Parameters:
filler
- The item for the filler element
-
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
-
setAlignment
Set the alignment of the elements in this group- Parameters:
alignment
- The alignment
-
getAlignment
Get the alignment of the elements in this group- Returns:
- The alignment
-