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
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 removeItems)
      Creates a new BaseCanvasGUI
      Parameters:
      plugin - The plugin
      title - The title of the GUI
      type - The type of the GUI
      removeItems - Whether to remove loose items on close. The first player that closes the gui gets the items
  • 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 void searchSection(SearchData searchData)
      Searches the GUI recursively. The SearchData is filled recursively.
      Specified by:
      searchSection in class GUI
      Parameters:
      searchData - The searchData that contains all needed information
    • provideItem

      public void provideItem(org.bukkit.inventory.ItemStack item)
      Description copied from class: GUI
      Used to provide items to GUIPanes. The amount of the ItemStack will be modified if a pane accepted an ItemStack.
      Specified by:
      provideItem in class GUI
      Parameters:
      item - The ItemStack that is provided.
    • getCanvas

      public C getCanvas()
      Returns:
      The main canvas