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
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseCanvasGUI(org.bukkit.plugin.Plugin plugin, net.kyori.adventure.text.TextComponent title, org.bukkit.event.inventory.InventoryType type, boolean registerDefaultHandlers) Creates a new BaseCanvasGUI -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.InventoryCreates a new Bukkit Inventory for the GUI when implementedgetClickedSection(int slot) Uses recursion to find the GUISection which was clickedgetSize()intgetSlots()protected List<org.bukkit.inventory.ItemStack>Renders the GUI on a listprotected voidSets the canvas for this GUI.Methods inherited from class de.placeblock.betterinventories.gui.GUI
getPlayers, getView, onClose, onInventoryClick, onInventoryClose, onInventoryDrag, registerInteractionHandler, reloadViews, render, showPlayer, unregisterInteractionHandler, update, updateViews
-
Field Details
-
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 plugintitle- The title of the GUItype- The type of the GUIregisterDefaultHandlers- Whether to register default-handlers
-
-
Method Details
-
setCanvas
Sets the canvas for this GUI. Should be done before usinggetCanvas()- Parameters:
canvas- The canvas to be set
-
getSlots
public int getSlots() -
createBukkitInventory
public org.bukkit.inventory.Inventory createBukkitInventory()Description copied from class:GUICreates a new Bukkit Inventory for the GUI when implemented- Specified by:
createBukkitInventoryin classGUI- Returns:
- A new Bukkit Inventory matching the size or type of this GUI
-
getSize
- Returns:
- The Size of this GUI as a Vector
-
renderContent
Description copied from class:GUIRenders the GUI on a list- Specified by:
renderContentin classGUI- Returns:
- The rendered representation of the canvas
-
getClickedSection
Uses recursion to find the GUISection which was clicked- Specified by:
getClickedSectionin classGUI- Parameters:
slot- The slot that got clicked- Returns:
- The section which lies at the specific slot, or null if there is no section.
-
getCanvas
- Returns:
- The main canvas
-