Dynamic GUI
A generic dynamic GUI framework for creating inventories with an adaptive state-based design.
Since
1.1.0
The DynamicGUI
class extends InventoryGUI
to provide enhanced functionality for creating GUIs that dynamically change based on specific predefined states. Each state is defined by an enum parameter, allowing the GUI to map buttons and functionality specific to each state.
Features:
Manages state transitions and updates the GUI accordingly.
Allows the creation of mappings between states and button configurations.
Supports dynamic updates of inventory content based on the current state.
Parameters
The type of the state enumeration that defines the various states the GUI can have.
The player for whom this GUI is being created.
See also
Functions
Adds a single item to the existing item list.
Abstract method for building the inventory GUI. This method should be implemented by subclasses to define the layout and items of the GUI.
Gets the background material set for the inventory GUI.
Returns the inventory associated with this GUI.
Gets the current listener associated with this GUI.
Sets a handler to be called when this GUI is closed.
Sets the background material for the inventory GUI.
Sets the button mappings for the DynamicGUI. Each state is associated with a list of buttons that define the appearance and functionality of the GUI in that state.
Sets multiple items at once for the GUI. This replaces the existing item list.
Sets the listener for handling GUI events.
Sets whether the global listener should be called on inventory events.
Sets the size of the inventory GUI.
Sets the current state of the DynamicGUI to the specified initial state.
Sets the title of the inventory GUI.
Indicates whether the global listener should be called on inventory events.
Updates the state of the DynamicGUI to a new state and refreshes the buttons to match the new state. If the new state is the same as the current state, no action is taken.
Updates the inventory GUI to reflect the buttons associated with the current state. This method clears the existing inventory, applies a background if specified, and sets the buttons mapped to the current state into the inventory.