Class GuiManager

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

public class GuiManager extends Object
Central manager for handling the lifecycle and updates of custom GUIs.

This class facilitates opening and closing menus, tracking active views, and running the global tick task that drives GUI animations and logic.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Map<org.bukkit.inventory.InventoryView, GuiView>
    A map of active Bukkit InventoryViews to their corresponding AbyssalLib GuiViews.
    static final Map<GuiView, ScheduledTask>
    A map of active BukkitTasks to their corresponding GUiViews.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    close(org.bukkit.entity.HumanEntity player)
    Closes the currently open GUI for a player and unregisters its view.
    static void
    open(org.bukkit.entity.HumanEntity player, Gui gui)
    Opens a custom GUI for a player.
    static void
    Removed the GUiView from both Maps so that users may open a new gui over old gui.

    Methods inherited from class Object

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

    • OPEN_VIEWS

      public static final Map<org.bukkit.inventory.InventoryView, GuiView> OPEN_VIEWS
      A map of active Bukkit InventoryViews to their corresponding AbyssalLib GuiViews.
    • TICK_VIEWS

      public static final Map<GuiView, ScheduledTask> TICK_VIEWS
      A map of active BukkitTasks to their corresponding GUiViews.
  • Constructor Details

    • GuiManager

      public GuiManager()
  • Method Details

    • open

      public static void open(org.bukkit.entity.HumanEntity player, Gui gui)
      Opens a custom GUI for a player.

      This method validates the player's state (e.g., not sleeping) before creating the inventory and registering the active view.

      Parameters:
      player - the player for whom to open the GUI
      gui - the GUI template to display
    • close

      public static void close(org.bukkit.entity.HumanEntity player)
      Closes the currently open GUI for a player and unregisters its view.
      Parameters:
      player - the player whose GUI should be closed
    • remove

      public static void remove(GuiView view)
      Removed the GUiView from both Maps so that users may open a new gui over old gui.
      Parameters:
      view - THe view to remove.