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 int
default int
addItem
(GUIItem item, @Nullable AddItemCondition condition) Adds the item at the next available slot.default int
default int
addItem
(ItemStack is, @Nullable AddItemCondition condition) default int
addItem
(ItemStack is, ClickListener listener) default int
addItem
(ItemStack is, ClickListener listener, @Nullable AddItemCondition condition) default int
calcSlot
(int x, int y) void
Replaces any slot with the given itemdefault void
Replaces any slot with the given itemdefault void
fill
(ItemStack is, ClickListener listener) Replaces any slot with the given item and listens for clicksvoid
Replaces any empty/air slot with the given itemdefault void
Replaces any empty/air slot with the given itemdefault void
fillSpace
(ItemStack is, ClickListener listener) Replaces any empty/air slot with the given item and listens for clicksdefault void
formatAnyColumn
(CenterFormat format) default void
formatAnyColumn
(CenterFormat format, int min, int max) default void
formatAnyRow
(CenterFormat format) default void
formatAnyRow
(CenterFormat format, int min, int max) default void
formatColumn
(int x, CenterFormat format) default void
formatColumn
(int x, CenterFormat format, int min, int max) default void
formatRow
(int y, CenterFormat format) default void
formatRow
(int y, CenterFormat format, int min, int max) int
Returns the amount of items that fit in a column@Nullable GUIItem
getItem
(int slot) Returns the item at the specific slot.default @Nullable GUIItem
getItem
(int x, int y) Returns the item at the specific x and y slot.default int
Starts at slot 0 and tries to find the next available/empty slot.
Returns -1 if it didn't find anyint
getNextSpace
(@Nullable AddItemCondition condition) Starts at slot 0 and tries to find the next available/empty slot.
Returns -1 if it didn't find anydefault int
getSize()
Returns the total amount of items/slots that fit into this GUIint
getWidth()
Returns the amount of items that fit in a rowvoid
Set an item at a specific slotdefault void
default void
Set an item at a specific slotdefault void
Set an item at a specific x and y coordinatedefault void
setItem
(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 void
setItem
(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)
-