public abstract class BaseGui extends Object implements org.bukkit.inventory.InventoryHolder
Gui| Constructor and Description |
|---|
BaseGui(@NotNull GuiType guiType,
@NotNull String title)
Alternative constructor that takes
GuiType instead of rows number |
BaseGui(int rows,
@NotNull String title)
Main constructor that takes rows
|
| Modifier and Type | Method and Description |
|---|---|
void |
addItem(GuiItem... items)
Adds
GuiItems to the GUI without specific slot
It'll set the item to the next empty slot available |
void |
addSlotAction(int slot,
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
Adds a
GuiAction for when clicking on a specific slot
See InventoryClickEvent |
void |
addSlotAction(int row,
int col,
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
Alternative method for
addSlotAction(int, GuiAction) to add a GuiAction to a specific slot using ROWS and COLUMNS instead of slots
See InventoryClickEvent |
void |
close(@NotNull org.bukkit.entity.HumanEntity player)
Closes the GUI with a
2s delay (to prevent items from being taken from the Inventory) |
@NotNull GuiFiller |
getFiller()
Gets the
GuiFiller that it's used for filling up the GUI in specific ways |
@Nullable GuiItem |
getGuiItem(int slot)
Gets a specific
GuiItem on the slot |
Map<Integer,GuiItem> |
getGuiItems()
Gets an immutable
Map with all the GUI items |
@NotNull org.bukkit.inventory.Inventory |
getInventory()
Gets the main
Inventory of this GUI |
int |
getRows()
Gets the amount of
rows |
boolean |
isUpdating()
Checks whether or not the GUI is updating
|
void |
open(@NotNull org.bukkit.entity.HumanEntity player)
Opens the GUI for a
HumanEntity |
void |
setCloseGuiAction(@Nullable GuiAction<org.bukkit.event.inventory.InventoryCloseEvent> closeGuiAction)
Sets the
GuiAction to run once the inventory is closed
See InventoryCloseEvent |
void |
setDefaultClickAction(@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultClickAction)
Sets the
GuiAction of a default click on any item
See InventoryClickEvent |
void |
setDefaultTopClickAction(@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultTopClickAction)
Sets the
GuiAction of a default click on any item on the top part of the GUI
Top inventory being for example chests etc, instead of the Player inventory
See InventoryClickEvent |
void |
setDragAction(@Nullable GuiAction<org.bukkit.event.inventory.InventoryDragEvent> dragAction)
Sets the
GuiAction of a default drag action
See InventoryDragEvent |
void |
setItem(int slot,
@NotNull GuiItem guiItem)
Sets the
GuiItem to a specific slot on the GUI |
void |
setItem(int row,
int col,
@NotNull GuiItem guiItem)
Alternative
setItem(int, GuiItem) to set item that uses ROWS and COLUMNS instead of slots |
void |
setItem(@NotNull List<Integer> slots,
@NotNull GuiItem guiItem)
Alternative
setItem(int, GuiItem) to set item that takes a List of slots instead |
void |
setOpenGuiAction(@Nullable GuiAction<org.bukkit.event.inventory.InventoryOpenEvent> openGuiAction)
Sets the
GuiAction to run when the GUI opens
See InventoryOpenEvent |
void |
setOutsideClickAction(@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> outsideClickAction)
Sets the
GuiAction to run when clicking on the outside of the inventory
See InventoryClickEvent |
BaseGui |
setRows(int rows)
Sets the number of rows the GUI should have
|
void |
setUpdating(boolean updating)
Sets the updating status of the GUI
|
void |
update()
Updates the GUI for all the
Inventory views |
void |
updateItem(int slot,
@NotNull GuiItem item)
Alternative
updateItem(int, ItemStack) but creates a new GuiItem |
void |
updateItem(int row,
int col,
@NotNull GuiItem item)
Alternative
updateItem(int, GuiItem) that takes ROWS and COLUMNS instead of slots |
void |
updateItem(int row,
int col,
@NotNull org.bukkit.inventory.ItemStack itemStack)
Alternative
updateItem(int, ItemStack) that takes ROWS and COLUMNS instead of slots |
void |
updateItem(int slot,
@NotNull org.bukkit.inventory.ItemStack itemStack)
Updates the specified item in the GUI at runtime, without creating a new
GuiItem |
BaseGui |
updateTitle(@NotNull String title)
Updates the title of the GUI
This method may cause LAG if used on a loop
|
public BaseGui(int rows,
@NotNull
@NotNull String title)
rows - The amount of rows the GUI should havetitle - The GUI titlepublic BaseGui setRows(int rows)
rows - The number of rows to setpublic void setItem(int slot,
@NotNull
@NotNull GuiItem guiItem)
GuiItem to a specific slot on the GUIslot - The GUI slotguiItem - The GuiItem to add to the slotpublic void setItem(@NotNull
@NotNull List<Integer> slots,
@NotNull
@NotNull GuiItem guiItem)
setItem(int, GuiItem) to set item that takes a List of slots insteadslots - The slots in which the item should goguiItem - The GuiItem to add to the slotspublic void setItem(int row,
int col,
@NotNull
@NotNull GuiItem guiItem)
setItem(int, GuiItem) to set item that uses ROWS and COLUMNS instead of slotsrow - The GUI row numbercol - The GUI column numberguiItem - The GuiItem to add to the slotpublic void addItem(@NotNull
GuiItem... items)
GuiItems to the GUI without specific slot
It'll set the item to the next empty slot availableitems - Varargs for specifying the GuiItemspublic void setDefaultClickAction(@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultClickAction)
GuiAction of a default click on any item
See InventoryClickEventdefaultClickAction - GuiAction to resolve when any item is clickedpublic void setDefaultTopClickAction(@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> defaultTopClickAction)
GuiAction of a default click on any item on the top part of the GUI
Top inventory being for example chests etc, instead of the Player inventory
See InventoryClickEventdefaultTopClickAction - GuiAction to resolve when clicking on the top inventorypublic void setOutsideClickAction(@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> outsideClickAction)
GuiAction to run when clicking on the outside of the inventory
See InventoryClickEventoutsideClickAction - GuiAction to resolve when clicking outside of the inventorypublic void setDragAction(@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryDragEvent> dragAction)
GuiAction of a default drag action
See InventoryDragEventdragAction - GuiAction to resolvepublic void setCloseGuiAction(@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryCloseEvent> closeGuiAction)
GuiAction to run once the inventory is closed
See InventoryCloseEventcloseGuiAction - GuiAction to resolve when the inventory is closedpublic void setOpenGuiAction(@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryOpenEvent> openGuiAction)
GuiAction to run when the GUI opens
See InventoryOpenEventopenGuiAction - GuiAction to resolve when opening the inventorypublic void addSlotAction(int slot,
@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
GuiAction for when clicking on a specific slot
See InventoryClickEventpublic void addSlotAction(int row,
int col,
@Nullable
@Nullable GuiAction<org.bukkit.event.inventory.InventoryClickEvent> slotAction)
addSlotAction(int, GuiAction) to add a GuiAction to a specific slot using ROWS and COLUMNS instead of slots
See InventoryClickEventrow - The row of the slotcol - The column of the slotslotAction - GuiAction to resolve when clicking on the slot@Nullable public @Nullable GuiItem getGuiItem(int slot)
GuiItem on the slotslot - The slot of the itemGuiItem on the introduced slot or null if doesn't existpublic boolean isUpdating()
public void setUpdating(boolean updating)
updating - Sets the GUI to the updating statuspublic void open(@NotNull
@NotNull org.bukkit.entity.HumanEntity player)
HumanEntityplayer - The HumanEntity to open the GUI topublic void close(@NotNull
@NotNull org.bukkit.entity.HumanEntity player)
2s delay (to prevent items from being taken from the Inventory)player - The HumanEntity to close the GUI topublic void update()
Inventory viewspublic void updateItem(int slot,
@NotNull
@NotNull org.bukkit.inventory.ItemStack itemStack)
GuiItemslot - The slot of the item to updateitemStack - The ItemStack to replace in the original one in the GuiItempublic void updateItem(int row,
int col,
@NotNull
@NotNull org.bukkit.inventory.ItemStack itemStack)
updateItem(int, ItemStack) that takes ROWS and COLUMNS instead of slotsrow - The row of the slotcol - The columns of the slotitemStack - The ItemStack to replace in the original one in the GuiItempublic void updateItem(int slot,
@NotNull
@NotNull GuiItem item)
updateItem(int, ItemStack) but creates a new GuiItemslot - The slot of the item to updateitem - The GuiItem to replace in the originalpublic void updateItem(int row,
int col,
@NotNull
@NotNull GuiItem item)
updateItem(int, GuiItem) that takes ROWS and COLUMNS instead of slotsrow - The row of the slotcol - The columns of the slotitem - The GuiItem to replace in the originalpublic BaseGui updateTitle(@NotNull @NotNull String title)
title - The title to set@NotNull public @NotNull GuiFiller getFiller()
GuiFiller that it's used for filling up the GUI in specific waysGuiFiller@NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()
Inventory of this GUIgetInventory in interface org.bukkit.inventory.InventoryHolderCopyright © 2020. All rights reserved.