java.lang.Object
com.shanebeestudios.snippets.gui.GUI
All Implemented Interfaces:
Listener, InventoryHolder

public class GUI extends Object implements InventoryHolder, Listener
Create custom GUIs
Make sure to set the plugin (this is used for event listeners) see setPlugin(Plugin)
  • Method Details

    • setPlugin

      public static void setPlugin(@NotNull @NotNull Plugin plugin)
      Set the plugin used for listening to events.
      Parameters:
      plugin - Instance of your plugin
    • chestBuilder

      public static GUI chestBuilder(int rows, @Nullable @Nullable String title)
      Create a chest GUI builder
      Parameters:
      rows - Number of rows for the chest (must be between 1 and 6)
      title - Title of your GUI
      Returns:
      Instance of GUI builder
    • customBuilder

      public static GUI customBuilder(InventoryType type, @Nullable @Nullable String title)
      Create a custom GUI builder using any inventory type
      Parameters:
      type - Type of GUI to create
      title - Title of your GUI
      Returns:
      Instance of GUI builder
    • formatSlot

      public GUI formatSlot(int slot, @NotNull @NotNull ItemStack itemStack, Consumer<GUI.InventoryData> data)
      Format a slot in the GUI to run a function
      Parameters:
      slot - Slot to set
      itemStack - ItemStack to appear in slot
      data - Consumer to run when clicked with data from event
      Returns:
      Instance of GUI builder
    • formatSlots

      public GUI formatSlots(int[] slots, @NotNull @NotNull ItemStack itemStack, Consumer<GUI.InventoryData> data)
      Format multiple slots in the GUI to run a function
      Parameters:
      slots - Slots to set
      itemStack - ItemStack to appear in slot
      data - Consumer to run when clicked with data from event
      Returns:
      Instance of GUI builder
    • lockSlot

      public GUI lockSlot(int slot, @NotNull @NotNull ItemStack itemStack)
      Lock a slot
      Parameters:
      slot - Slot to lock
      itemStack - ItemStack to appear in slot
      Returns:
      Instance of GUI builder
    • fill

      public GUI fill(@NotNull @NotNull ItemStack itemStack, Consumer<GUI.InventoryData> data)
      Fill the GUI with an item to run a function when clicked
      Parameters:
      itemStack - ItemStack to appear in all slots
      data - Consumer to run when clicked with data from event
      Returns:
      Instance of GUI builder
    • fill

      public GUI fill(@NotNull @NotNull ItemStack itemStack)
      Fill the GUI with an item
      Parameters:
      itemStack - ItemStack to appear in all slots
      Returns:
      Instance of GUI builder
    • getInventory

      @NotNull public @NotNull Inventory getInventory()
      Get the inventory from this GUI
      Specified by:
      getInventory in interface InventoryHolder
      Returns:
      Inventory from this GUI
    • open

      public GUI open(Player player)
      Open this GUI to a player
      Parameters:
      player - Player to open GUI for
      Returns:
      Instance of GUI builder