Class BaseCanvasGUI<C extends GUIPane>

java.lang.Object
de.placeblock.betterinventories.gui.GUI
de.placeblock.betterinventories.gui.impl.BaseCanvasGUI<C>
Type Parameters:
C - The type of the Canvas
All Implemented Interfaces:
org.bukkit.event.Listener
Direct Known Subclasses:
BaseChestGUI, CanvasGUI

public abstract class BaseCanvasGUI<C extends GUIPane> extends GUI
The Base Class for GUIs which only have just one canvas e.g. Chest, Hopper, Crafting... If you want to instantiate this one use CanvasGUI.
  • Field Details

    • canvas

      protected C extends GUIPane canvas
      The main canvas to which Sections can be added
  • Constructor Details

    • BaseCanvasGUI

      protected BaseCanvasGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.event.inventory.InventoryType type)
      Creates a new BaseCanvasGUI
      Parameters:
      plugin - The plugin
      title - The title of the GUI
      type - The type of the GUI
  • Method Details

    • setCanvas

      protected void setCanvas(C canvas)
      Sets the canvas for this GUI. Should be done before using getCanvas()
      Parameters:
      canvas - The canvas to be set
    • getSlots

      public int getSlots()
      Specified by:
      getSlots in class GUI
      Returns:
      The size of this GUI in slots
    • createBukkitInventory

      public org.bukkit.inventory.Inventory createBukkitInventory()
      Description copied from class: GUI
      Creates a new Bukkit Inventory for the GUI when implemented
      Specified by:
      createBukkitInventory in class GUI
      Returns:
      A new Bukkit Inventory matching the size or type of this GUI
    • getSize

      public Vector2d getSize()
      Returns:
      The Size of this GUI as a Vector
    • renderContent

      public List<org.bukkit.inventory.ItemStack> renderContent()
      Description copied from class: GUI
      Renders the GUI on a list
      Specified by:
      renderContent in class GUI
      Returns:
      The rendered representation of the canvas
    • searchSection

      public GUISection.SearchData searchSection(int slot, boolean onlyPanes)
      Uses recursion to find the GUISection which was clicked
      Specified by:
      searchSection in class GUI
      Parameters:
      slot - The slot that got clicked
      onlyPanes - Whether to return only panes even if there is an item at the clicked slot
      Returns:
      The section which lies at the specific slot, or null if there is no section.
    • provideItem

      public void provideItem(org.bukkit.inventory.ItemStack item)
      Description copied from class: GUI
      Used to provide items on MOVE_TO_OTHER_INVENTORY click event
      Specified by:
      provideItem in class GUI
      Parameters:
      item - The ItemStack that is provided
    • getCanvas

      public C getCanvas()
      Returns:
      The main canvas