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) Creates a new BaseCanvasGUI -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.InventoryCreates a new Bukkit Inventory for the GUI when implementedgetSize()intgetSlots()voidprovideItem(org.bukkit.inventory.ItemStack item) Used to provide items on MOVE_TO_OTHER_INVENTORY click eventList<org.bukkit.inventory.ItemStack>Renders the GUI on a listsearchSection(int slot, boolean onlyPanes) Uses recursion to find the GUISection which was clickedprotected voidSets the canvas for this GUI.Methods inherited from class de.placeblock.betterinventories.gui.GUI
dispatchAdd, dispatchAmount, dispatchRemove, getPlayers, getView, getView, onClose, onInventoryClick, onInventoryClose, onInventoryDrag, reloadViews, render, showPlayer, 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) Creates a new BaseCanvasGUI- Parameters:
plugin- The plugintitle- The title of the GUItype- The type of the GUI
-
-
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
-
searchSection
Uses recursion to find the GUISection which was clicked- Specified by:
searchSectionin classGUI- Parameters:
slot- The slot that got clickedonlyPanes- 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:GUIUsed to provide items on MOVE_TO_OTHER_INVENTORY click event- Specified by:
provideItemin classGUI- Parameters:
item- The ItemStack that is provided
-
getCanvas
- Returns:
- The main canvas
-