πŸ’»Developer API

πŸ’» FOR DEVELOPERS

Developer API

Create and manage GUIs programmatically with the Java API


GUIPlus provides a public API for developers to create and manage GUIs programmatically, register custom click events and conditions, and interact with the player data system.

Note: The GUIPlus API is designed around direct class usage. Since GUIPlus does not publish to a Maven repository, you will need to add the plugin JAR as a local dependency.

πŸ”Œ Getting the Plugin Instance

import com.infiniteplugins.guiplus.GUIPlus;

GUIPlus plugin = GUIPlus.getInstance();

πŸ–Ό Creating a GUI Programmatically

import com.infiniteplugins.guiplus.api.gui.GUI;
import com.infiniteplugins.guiplus.api.gui.data.Scene;
import com.infiniteplugins.guiplus.api.gui.data.GuiItem;

// Create a new chest GUI
GUI gui = new GUI("myCustomGui", GUI.Type.CHEST);
gui.setTitle("&6My Custom Menu");
gui.setRows(3);

// Register the GUI with the manager
GUIPlus.getGuiManager().addGui(gui);

πŸ“¦ GUI Types

The GUI.Type enum provides these inventory types:

πŸ” Accessing Existing GUIs

🎯 Opening a GUI for a Player

πŸ–± Custom Click Events

Create custom click event types by extending the GUIClick class:

Important: Always call clickableProcess.notifyProcess() at the end of your onClick method. This signals the event processing pipeline to proceed with the next click event in the sequence.

βœ… Custom Conditions

Create custom condition types by extending the GUICondition class:

Note: The inverted property is handled automatically by the base class. Your canDisplayInternal should return the non-inverted result.

πŸ’Ύ Player Data API

Access the persistent player data system:

Note: PlayerData is a Java record. Each call to getPlayerData() creates a new instance, but all instances share the same underlying YAML config. Changes via setValue are saved to disk immediately.

πŸ’¬ Chat Fetcher API

Programmatically prompt a player for chat input:

Important: You must call .build() at the end to register the chat fetcher with the manager. The onFetch callback must return a Boolean β€” true to accept the input and complete, false to reject and keep waiting.

⏱ Scheduler Utilities

GUIPlus provides a scheduler wrapper for running tasks:

πŸ“‘ Event Listeners

GUIPlus registers the following Bukkit events in GuiManager:

Event
Priority
Purpose

InventoryClickEvent

LOWEST

GUI item click handling

InventoryCloseEvent

LOWEST

GUI close handling and cleanup

Note: InventoryDragEvent is handled separately in the internal SystemGuiManager for the editor, not in the public GuiManager.

πŸ“¦ Maven / Local Dependency

Since GUIPlus is not published to a remote Maven repository, add the plugin JAR as a local dependency:

Add GUIPlus to your plugin.yml dependencies:


Tip: Looking for YAML-based configuration instead of the Java API? Most GUIPlus features can be achieved entirely through YAML files. See Creating GUIs for the full YAML reference.


← Previous

Last updated