Class GuiBuilder
java.lang.Object
me.tippie.tippieutils.v1_2_0.guis.GuiBuilder
-
Constructor Summary
ConstructorsConstructorDescriptionGuiBuilder(int rows, String title, org.bukkit.inventory.InventoryHolder holder)Creates a new GUIBuilder given the amount of rows, title and the inventory holder.GuiBuilder(org.bukkit.inventory.Inventory inventory)Creates a new GUIBuilder given an Inventory. -
Method Summary
Modifier and TypeMethodDescriptiongetName()booleanopen(org.bukkit.entity.Player player, GuiManager manager)Opens the GUI for the given player.setAlwaysRunGeneralConsumer(boolean alwaysRunGeneralConsumer)Sets whether the general click consumer should always be ran even if there is another slot specific consumer set for the clicked slot.setCloseConsumer(BiConsumer<org.bukkit.event.inventory.InventoryCloseEvent,OpenGUI> consumer)Sets the close consumer of the GUI.setGeneralClickConsumer(BiConsumer<org.bukkit.event.inventory.InventoryClickEvent,OpenGUI> consumer)Sets the general click consumer.Sets the name of the GUI.setSlot(int slot, org.bukkit.inventory.ItemStack item, BiConsumer<org.bukkit.event.inventory.InventoryClickEvent,OpenGUI> consumer)Sets the item in the slot.
-
Constructor Details
-
GuiBuilder
Creates a new GUIBuilder given the amount of rows, title and the inventory holder.- Parameters:
rows- The amount of rows for the GUI.title- The title of the GUI.holder- The inventory holder of the GUI.
-
GuiBuilder
public GuiBuilder(org.bukkit.inventory.Inventory inventory)Creates a new GUIBuilder given an Inventory.- Parameters:
inventory- The inventory to use.
-
-
Method Details
-
setSlot
public GuiBuilder setSlot(int slot, org.bukkit.inventory.ItemStack item, BiConsumer<org.bukkit.event.inventory.InventoryClickEvent,OpenGUI> consumer)Sets the item in the slot.- Parameters:
slot- The slot to set the item in.item- The item to set.consumer- The consumer to run when the item is clicked.- Returns:
- The GUIBuilder instance.
-
setName
Sets the name of the GUI. This is not the title of the GUI but a value you can use internally in a plugin.- Parameters:
name- The name of the GUI.- Returns:
- The GUIBuilder instance.
-
setGeneralClickConsumer
public GuiBuilder setGeneralClickConsumer(BiConsumer<org.bukkit.event.inventory.InventoryClickEvent,OpenGUI> consumer)Sets the general click consumer. This is the consumer which is ran when any slot with the inventory open is clicked. This includes slots outside of the inventory but still in the inventory view!- Parameters:
consumer- The consumer to run.- Returns:
- The GUIBuilder instance.
-
setCloseConsumer
public GuiBuilder setCloseConsumer(BiConsumer<org.bukkit.event.inventory.InventoryCloseEvent,OpenGUI> consumer)Sets the close consumer of the GUI. This is the consumer which is ran when the inventory is closed. You can cancel the close event by calling OpenGUI#setCancelNextClose(boolean).- Parameters:
consumer- The consumer to run.- Returns:
- The GUIBuilder instance.
-
setAlwaysRunGeneralConsumer
Sets whether the general click consumer should always be ran even if there is another slot specific consumer set for the clicked slot.- Parameters:
alwaysRunGeneralConsumer- Whether the general click consumer should always be ran.- Returns:
- The GUIBuilder instance.
-
open
Opens the GUI for the given player.- Parameters:
player- The player to open the GUI for.manager- The OpenGUI manager to use.- Returns:
- The OpenGUI instance for the GUI.
-
isAlwaysRunGeneralConsumer
public boolean isAlwaysRunGeneralConsumer() -
getName
-