Interface ClickableGUI
- All Superinterfaces:
GUI
- All Known Implementing Classes:
ChestGUI
Extends GUI and adds methods for clickable items
-
Method Summary
Modifier and TypeMethodDescriptiondefault intAdds the item at the next available slot.default intaddItem(GUIItem item, @Nullable AddItemCondition condition) Adds the item at the next available slot.default intAdds the item at the next available slot.default intaddItem(ItemStack is, @Nullable AddItemCondition condition) Adds the item at the next available slot.default intaddItem(ItemStack is, ClickListener listener) Adds the item at the next available slot.default intaddItem(ItemStack is, ClickListener listener, @Nullable AddItemCondition condition) Adds the item at the next available slot.default intcalcSlot(int x, int y) Calculates an item slot/index using a coordinate system.voidReplaces any slot with the given itemdefault voidReplaces any slot with the given itemdefault voidfill(ItemStack is, ClickListener listener) Replaces any slot with the given item and listens for clicksvoidReplaces any empty/air slot with the given itemdefault voidReplaces any empty/air slot with the given itemdefault voidfillSpace(ItemStack is, ClickListener listener) Replaces any empty/air slot with the given item and listens for clicksdefault voidformatAnyColumn(CenterFormat format) Reformats all items of all column.default voidformatAnyColumn(CenterFormat format, int min, int max) Reformats all items of all column.default voidformatAnyRow(CenterFormat format) Reformats all items of all rows.default voidformatAnyRow(CenterFormat format, int min, int max) Reformats all items of all rows.default voidformatColumn(int x, CenterFormat format) Reformats all items within a column.default voidformatColumn(int x, CenterFormat format, int min, int max) Reformats all items within a column.default voidformatRow(int y, CenterFormat format) Reformats all items within a row.default voidformatRow(int y, CenterFormat format, int min, int max) Reformats all items within a row.intReturns the amount of items that fit in a column@Nullable GUIItemgetItem(int slot) Returns the item at the specific slot.default @Nullable GUIItemgetItem(int x, int y) Returns the item at the specific x and y slot.default intStarts at slot 0 and tries to find the next available/empty slot.
Returns -1 if it didn't find anyintgetNextSpace(@Nullable AddItemCondition condition) Starts at slot 0 and tries to find the next available/empty slot.
Returns -1 if it didn't find anydefault intgetSize()Returns the total amount of items/slots that fit into this GUIintgetWidth()Returns the amount of items that fit in a rowvoidSet an item at a specific slotdefault voidSet an item at a specific x and y coordinate and listen whenever someone clicks on itdefault voidSet an item at a specific slotdefault voidSet an item at a specific x and y coordinatedefault voidsetItem(ItemStack is, int x, int y, ClickListener listener) Set an item at a specific x and y coordinate and listen whenever someone clicks on itdefault voidsetItem(ItemStack is, int slot, ClickListener listener) Set an item at a specific slot and listen whenever someone clicks on itMethods inherited from interface GUI
addCloseListener, areItemsMoveable, clear, closeAll, getCloseListeners, getPlayers, getTitle, hasOpen, ignoresCancelEvent, onClose, open, removeCloseListener, setTitle
-
Method Details
-
getWidth
int getWidth()Returns the amount of items that fit in a row- Returns:
- The width of the GUI
-
getHeight
int getHeight()Returns the amount of items that fit in a column- Returns:
- The width of the GUI
-
getSize
default int getSize()Returns the total amount of items/slots that fit into this GUI- Returns:
- The size of the GUI
-
setItem
Set an item at a specific slot- Parameters:
item- The item to be setslot- The target slot
-
getItem
Returns the item at the specific slot. May return null if there's none- Parameters:
slot- The slot at which the item may be- Returns:
- The placed item. May be null
-
fill
-
fillSpace
Replaces any empty/air slot with the given item- Parameters:
item- The given item
-
fill
Replaces any slot with the given item- Parameters:
is- The given item
-
fill
Replaces any slot with the given item and listens for clicks- Parameters:
is- The given itemlistener- The click listener
-
fillSpace
Replaces any empty/air slot with the given item- Parameters:
is- The given item
-
fillSpace
Replaces any empty/air slot with the given item and listens for clicks- Parameters:
is- The given itemlistener- The click listener
-
setItem
Set an item at a specific x and y coordinate and listen whenever someone clicks on it- Parameters:
item- The item to be setx- The target x coordinatey- The target y coordinate
-
setItem
Set an item at a specific slot and listen whenever someone clicks on it- Parameters:
is- The item to be setslot- The target slotlistener- Listens whenever someone clicks on the item
-
setItem
Set an item at a specific x and y coordinate and listen whenever someone clicks on it- Parameters:
is- The item to be setx- The target x coordinatey- The target y coordinatelistener- Listens whenever someone clicks on the item
-
setItem
Set an item at a specific slot- Parameters:
is- The item to be setslot- The target slot
-
setItem
Set an item at a specific x and y coordinate- Parameters:
is- The item to be setx- The target x coordinatey- The target y coordinate
-
getItem
Returns the item at the specific x and y slot. May return null if there's none- Parameters:
x- The target x coordinatey- The target y coordinate- Returns:
- The placed item. May be null
-
getNextSpace
Starts at slot 0 and tries to find the next available/empty slot.
Returns -1 if it didn't find any- Parameters:
condition- You may specify the search at a specific area- Returns:
- The next available/empty slot. -1 if the inventory is full
-
getNextSpace
default int getNextSpace()Starts at slot 0 and tries to find the next available/empty slot.
Returns -1 if it didn't find any- Returns:
- The next available/empty slot. -1 if the inventory is full
-
addItem
Adds the item at the next available slot.Keep in mind that items with the same materials don't get filled up.
- Parameters:
item- The item you want to addcondition- You may specify the search at a specific area- Returns:
- The slot to which it was added. -1 if the inventory is full
-
addItem
Adds the item at the next available slot.Keep in mind that items with the same materials don't get filled up.
- Parameters:
item- The item you want to add- Returns:
- The slot to which it was added. -1 if the inventory is full
-
addItem
default int addItem(ItemStack is, ClickListener listener, @Nullable @Nullable AddItemCondition condition) Adds the item at the next available slot.Keep in mind that items with the same materials don't get filled up.
- Parameters:
is- The item you want to addlistener- The listener of the item you want to addcondition- You may specify the search at a specific area- Returns:
- The slot to which it was added. -1 if the inventory is full
-
addItem
Adds the item at the next available slot.Keep in mind that items with the same materials don't get filled up.
- Parameters:
is- The item you want to addlistener- The listener of the item you want to add- Returns:
- The slot to which it was added. -1 if the inventory is full
-
addItem
Adds the item at the next available slot.Keep in mind that items with the same materials don't get filled up.
- Parameters:
is- The item you want to addcondition- You may specify the search at a specific area- Returns:
- The slot to which it was added. -1 if the inventory is full
-
addItem
Adds the item at the next available slot.Keep in mind that items with the same materials don't get filled up.
- Parameters:
is- The item you want to add- Returns:
- The slot to which it was added. -1 if the inventory is full
-
formatRow
Reformats all items within a row.- Parameters:
y- The row to realign, starting at 0format- The format to use for the alignmentmin- The starting x coordinate to care for, starting at 0max- The ending x coordinate to care for, going up to 8
-
formatRow
Reformats all items within a row.- Parameters:
y- The row to realign, starting at 0format- The format to use for the alignment
-
formatColumn
Reformats all items within a column.- Parameters:
x- The column to realign, starting at 0format- The format to use for the alignmentmin- The starting y coordinate to care for, starting at 0max- The ending y coordinate to care for, going up togetHeight()-1
-
formatColumn
Reformats all items within a column.- Parameters:
x- The column to realign, starting at 0format- The format to use for the alignment
-
formatAnyRow
Reformats all items of all rows.- Parameters:
format- The format to use for the alignmentmin- The starting x coordinate to care for, starting at 0max- The ending x coordinate to care for, going up to 8
-
formatAnyColumn
Reformats all items of all column.- Parameters:
format- The format to use for the alignmentmin- The starting y coordinate to care for, starting at 0max- The ending y coordinate to care for, going up togetHeight()-1
-
formatAnyRow
Reformats all items of all rows.- Parameters:
format- The format to use for the alignment
-
formatAnyColumn
Reformats all items of all column.- Parameters:
format- The format to use for the alignment
-
calcSlot
default int calcSlot(int x, int y) Calculates an item slot/index using a coordinate system.- Parameters:
x- The x position of the item, ranges between 0 and 8y- The y position of the item, ranges between 0 and 5- Returns:
- The calculated item slot
-