Package de.marcely.bedwars.tools.gui
Interface ClickableGUI
- All Superinterfaces:
GUI
- All Known Implementing Classes:
ChestGUI
Extends GUI and adds methods for clickable items
-
Method Summary
Modifier and TypeMethodDescriptiondefault intdefault intaddItem(GUIItem item, @Nullable AddItemCondition condition) Adds the item at the next available slot.default intdefault intaddItem(ItemStack is, @Nullable AddItemCondition condition) default intaddItem(ItemStack is, ClickListener listener) default intaddItem(ItemStack is, ClickListener listener, @Nullable AddItemCondition condition) default intcalcSlot(int x, int y) 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) default voidformatAnyColumn(CenterFormat format, int min, int max) default voidformatAnyRow(CenterFormat format) default voidformatAnyRow(CenterFormat format, int min, int max) default voidformatColumn(int x, CenterFormat format) default voidformatColumn(int x, CenterFormat format, int min, int max) default voidformatRow(int y, CenterFormat format) default voidformatRow(int y, CenterFormat format, int min, int max) 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 voiddefault 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 de.marcely.bedwars.tools.gui.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
Replaces any slot with the given item- Parameters:
item- The given item
-
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
-
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
-
addItem
default int addItem(ItemStack is, ClickListener listener, @Nullable @Nullable AddItemCondition condition) -
addItem
-
addItem
-
addItem
-
formatRow
-
formatRow
-
formatColumn
-
formatColumn
-
formatAnyRow
-
formatAnyColumn
-
formatAnyRow
-
formatAnyColumn
-
calcSlot
default int calcSlot(int x, int y)
-