Class GUISection
java.lang.Object
de.placeblock.betterinventories.content.GUISection
- All Implemented Interfaces:
Sizeable
A GUISection is the most basic element that can be put inside GUIs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGUISection.AbstractBuilder<B extends GUISection.AbstractBuilder<B,P>, P extends GUISection> Builder for creating variousGUISection -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGUISection(GUI gui, Vector2d size, Vector2d minSize, Vector2d maxSize) Creates a new GUISection -
Method Summary
Modifier and TypeMethodDescription<T> List<T>getEmptyContentList(Class<T> clazz) Returns a List with the amount of slots in this Section filled with null values.intintgetSlots()intgetWidth()abstract booleanCalled when an item is added to an empty slotabstract booleanonItemAmount(Vector2d position, int amount) Called when the amount of an item in a slot changesabstract voidonItemClick(ClickData data) Called when a user clicks on an item.abstract org.bukkit.inventory.ItemStackonItemRemove(Vector2d position) Called when an item is removed from an empty slotabstract List<org.bukkit.inventory.ItemStack>render()Renders the Section on a listabstract voidsearch(SearchData searchData) Searches the GUISection recursively.voidSets the sizeslotToVector(int slot) Converts a slot to a vector based on the width of this SectionintvectorToSlot(Vector2d position) Converts a position to a slot based on the width of this SectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.placeblock.betterinventories.Sizeable
clampSize, getMaxSize, getMinSize, getSize
-
Field Details
-
minSize
The minimum size of the Section -
maxSize
The maximum size of the Section
-
-
Constructor Details
-
GUISection
Creates a new GUISection- Parameters:
gui- The GUIsize- The size of the SectionminSize- The minimum size of the SectionmaxSize- The maximum size of the Section
-
-
Method Details
-
setSize
Sets the size- Parameters:
vector2d- The new size
-
render
Renders the Section on a list- Returns:
- The List
-
search
Searches the GUISection recursively. The SearchData is filled recursively.- Parameters:
searchData- The searchData that contains all needed information
-
slotToVector
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
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
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
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
Called when an item is added to an empty slot- Parameters:
position- The relative position of the slotitemStack- The itemstack that was added- Returns:
- Whether this action is allowed.
-
onItemRemove
Called when an item is removed from an empty slot- Parameters:
position- The relative position of the slot- Returns:
- Whether this action is allowed.
-
onItemAmount
Called when the amount of an item in a slot changes- Parameters:
position- The relative position of the slotamount- The new amount of the item- Returns:
- Whether this action is allowed.
-