Guis API

Overview

The GUI system enables creation of dynamic, data-driven interfaces that can be customized per player with placeholders and real-time content updates. GUIs are defined in configuration files and can be opened programmatically with custom data.


GUI Operations

Opening GUIs

void openGui(Player player, String gui)

  • Description: Opens a predefined GUI for a player

  • Parameters:

    • player - Target player to show the GUI to

    • gui - GUI identifier as defined in configuration

  • Usage: Basic GUI opening, menu navigation, interface display

void openGui(Player player, String gui, Map<String, String> placeholders)

  • Description: Opens a GUI with custom placeholder values

  • Parameters:

    • player - Target player

    • gui - GUI identifier

    • placeholders - Map of placeholder keys to replacement values

  • Usage: Dynamic content, personalized interfaces, contextual menus

GUI Control

void closeGui(Player player)

  • Description: Closes the currently open GUI for a player

  • Parameters: player - Player whose GUI should be closed

  • Usage: Programmatic GUI closing, event handling, interface management


GUI Management

Dynamic Loading

void loadGui(String guiId, File guiFile)

  • Description: Loads a GUI configuration from a file

  • Parameters:

    • guiId - Unique identifier for the GUI

    • guiFile - Configuration file containing GUI definition

  • Usage: Runtime GUI loading, hot-reloading, dynamic GUI creation


Usage Examples

Basic GUI Operations

EdDungeonsGuisAPI guisAPI = EdDungeonsAPI.getInstance().getGuisAPI();

// Open a simple GUI
guisAPI.openGui(player, "main_menu");

// Open GUI with custom data
Map<String, String> placeholders = new HashMap<>();
placeholders.put("player_name", player.getName());
placeholders.put("player_balance", "1000");
placeholders.put("current_zone", "barn-zone");

guisAPI.openGui(player, "player_stats", placeholders);

// Close GUI programmatically
guisAPI.closeGui(player);

Last updated

Was this helpful?