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, boolean registerDefaultHandlers)
      Creates a new BaseCanvasGUI
      Parameters:
      plugin - The plugin
      title - The title of the GUI
      type - The type of the GUI
      registerDefaultHandlers - Whether to register default-handlers
  • 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
    • getClickedSection

      public GUISection getClickedSection(int slot)
      Uses recursion to find the GUISection which was clicked
      Specified by:
      getClickedSection in class GUI
      Parameters:
      slot - The slot that got clicked
      Returns:
      The section which lies at the specific slot, or null if there is no section.
    • getCanvas

      public C getCanvas()
      Returns:
      The main canvas