Class ChestGui
java.lang.Object
io.github.somesourcecode.someguiapi.scene.gui.Gui
io.github.somesourcecode.someguiapi.scene.gui.ChestGui
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder
Represents a GUI that can be shown to players.
- Since:
- 1.0.0
-
Field Summary
Fields inherited from class io.github.somesourcecode.someguiapi.scene.gui.Gui
dataHolder, dirtyFlags, inventory -
Constructor Summary
ConstructorsConstructorDescriptionChestGui(net.kyori.adventure.text.Component title, int rows) Constructs a new ChestGui with the specified title and number of rows. -
Method Summary
Modifier and TypeMethodDescription@NotNull org.bukkit.inventory.InventoryintgetRows()Returns the number of rows of this GUI.getScene()Returns theSceneof this GUI.net.kyori.adventure.text.ComponentgetTitle()Returns the title of this GUI.List<org.bukkit.entity.HumanEntity>Returns a list of human entities that are currently viewing this GUI.voidRequests a render of this GUI.voidrequestRender(boolean update) Requests a render of this GUI.voidsetRows(int rows) Sets the number of rows of this GUI.voidSets theSceneof this GUI.voidsetTitle(net.kyori.adventure.text.Component title) Sets the title of this GUI.voidshow(org.bukkit.entity.HumanEntity humanEntity) Shows this GUI to the specified human entity.Methods inherited from class io.github.somesourcecode.someguiapi.scene.gui.Gui
clearDirtyFlag, clearDirtyFlags, getDataHolder, getDirtyFlags, isDirty, isDirty, setDirtyFlag, update
-
Constructor Details
-
ChestGui
public ChestGui(net.kyori.adventure.text.Component title, int rows) Constructs a new ChestGui with the specified title and number of rows.- Parameters:
title- the titlerows- the number of rows (in range 1-6)- Since:
- 1.0.0
-
-
Method Details
-
show
public void show(org.bukkit.entity.HumanEntity humanEntity) Description copied from class:GuiShows this GUI to the specified human entity. -
requestRender
public void requestRender()Requests a render of this GUI. This will happen automatically when layout changes. However, this method must be called whenever a change occurs that can't be picked up by the system, e.g. the change of a lore. Note that the display won't be updated untilGui.update()is called.- Since:
- 2.0.0
- See Also:
-
requestRender
public void requestRender(boolean update) Requests a render of this GUI. This will happen automatically when layout changes. However, this method must be called whenever a change occurs that can't be picked up by the system, e.g. the change of a lore.- Parameters:
update- whether to update the GUI after requesting the render- Since:
- 2.0.0
- See Also:
-
getScene
Returns theSceneof this GUI.- Returns:
- the scene
- Since:
- 1.0.0
-
setScene
Sets theSceneof this GUI.- Parameters:
scene- the scene- Since:
- 1.0.0
-
getTitle
public net.kyori.adventure.text.Component getTitle()Returns the title of this GUI.- Returns:
- the title
- Since:
- 1.0.0
-
setTitle
public void setTitle(net.kyori.adventure.text.Component title) Sets the title of this GUI.- Parameters:
title- the title- Since:
- 1.0.0
-
getRows
public int getRows()Returns the number of rows of this GUI.- Returns:
- the number of rows
- Since:
- 1.0.0
-
setRows
public void setRows(int rows) Sets the number of rows of this GUI.- Parameters:
rows- the number of rows (in range 1-6)- Since:
- 1.0.0
-
getInventory
@NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()- Specified by:
getInventoryin interfaceorg.bukkit.inventory.InventoryHolder
-
getViewers
Description copied from class:GuiReturns a list of human entities that are currently viewing this GUI.- Specified by:
getViewersin classGui- Returns:
- a list of human entities viewing this GUI
-