Class GuiView

java.lang.Object
com.github.darksoulq.abyssallib.world.gui.GuiView

public class GuiView extends Object
Represents an active instance of a Gui being viewed by a player.

This class handles the runtime rendering of elements and layers, and provides access to both the top (GUI) and bottom (Player) inventory segments.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Defines the target inventory segment for rendering or interaction.
  • Constructor Summary

    Constructors
    Constructor
    Description
    GuiView(Gui gui, org.bukkit.inventory.InventoryView view)
    Constructs a new GuiView instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    close(org.bukkit.entity.HumanEntity player)
    Closes the inventory for the specified player and triggers the close handler.
    org.bukkit.inventory.Inventory
    Gets the bottom inventory segment (the player's inventory).
    getElementAt(GuiView.Segment segment, int slot)
    Retrieves the element assigned to a specific slot.
    Gets the GUI template used by this view.
    org.bukkit.inventory.InventoryView
    Gets the Bukkit InventoryView.
    org.bukkit.entity.Player
    Gets the Player viewing this GUI
    org.bukkit.inventory.Inventory
    Gets the top inventory segment (the custom GUI).
    void
    Updates the state of the GUI for the current tick.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GuiView

      public GuiView(Gui gui, org.bukkit.inventory.InventoryView view)
      Constructs a new GuiView instance.
      Parameters:
      gui - the gui template
      view - the active inventory view
  • Method Details

    • getGui

      public Gui getGui()
      Gets the GUI template used by this view.
      Returns:
      the gui
    • getInventoryView

      public org.bukkit.inventory.InventoryView getInventoryView()
      Gets the Bukkit InventoryView.
      Returns:
      the inventory view
    • getPlayer

      public org.bukkit.entity.Player getPlayer()
      Gets the Player viewing this GUI
      Returns:
      The player
    • getTop

      public org.bukkit.inventory.Inventory getTop()
      Gets the top inventory segment (the custom GUI).
      Returns:
      the top inventory
    • getBottom

      public org.bukkit.inventory.Inventory getBottom()
      Gets the bottom inventory segment (the player's inventory).
      Returns:
      the player inventory
    • render

      public void render()
      Updates the state of the GUI for the current tick.

      This method renders all active layers, executes ticker logic, and updates slot contents based on the elements defined in the Gui.

    • close

      public void close(org.bukkit.entity.HumanEntity player)
      Closes the inventory for the specified player and triggers the close handler.
      Parameters:
      player - the player viewing the GUI
    • getElementAt

      public GuiElement getElementAt(GuiView.Segment segment, int slot)
      Retrieves the element assigned to a specific slot.
      Parameters:
      segment - the inventory segment
      slot - the slot index
      Returns:
      the GuiElement, or null if empty