Class GuiBuilder

java.lang.Object
me.tippie.tippieutils.v1_2_0.guis.GuiBuilder

public class GuiBuilder extends Object
  • Constructor Details

    • GuiBuilder

      public GuiBuilder(int rows, String title, org.bukkit.inventory.InventoryHolder holder)
      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

      public GuiBuilder setName(String name)
      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

      public GuiBuilder 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.
      Parameters:
      alwaysRunGeneralConsumer - Whether the general click consumer should always be ran.
      Returns:
      The GUIBuilder instance.
    • open

      public OpenGUI open(org.bukkit.entity.Player player, GuiManager manager)
      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

      public String getName()