UltimateUI guide
Building UIs
Build entire UI pages from code — no editor required. UiBuilder collects elements in memory, and the API saves them as a regular page file (plugins/UltimateUI/pages/<name>.yml), so a built page behaves exactly like a hand-authored one: it can be opened, edited in the editor later, or referenced by name from commands and Skript.
| Method | Returns | Description |
|---|---|---|
createGui(String name) | UiBuilder | Starts a new in-memory page builder with the given page name. |
saveGui(UiBuilder) | boolean | Writes the page to pages/<name>.yml. Overwrites an existing file with that name. |
openGui(Player, UiBuilder) | boolean | Saves the builder, then opens it as a full-screen cursor menu. |
openGui(Player, UiBuilder, boolean autoClose) | boolean | Same, closing automatically after its animations end. |
openGuiHud(Player, UiBuilder) | boolean | Saves the builder, then opens it as a HUD overlay (player can still move). |
openGuiHud(Player, UiBuilder, boolean autoClose) | boolean | HUD overlay that closes automatically after its animations end. |
UiBuilder methods#
| Method | Description |
|---|---|
screenSize(double width, double height) | Optional page resolution written as screen.width / screen.height. Defaults are used when omitted. |
addText(String id, String text, double x, double y, double w, double h, String hexColor) | Adds a text element. MiniMessage formatting is supported in the text. |
addText(String id, String text, double x, double y) | Text shorthand with a 200x32 size and default color. |
addBlock(String id, double x, double y, double w, double h, String hexColor) | Adds a solid colored rectangle. |
addItem(String id, String material, double x, double y, double w, double h) | Adds an item display for the given Material name (e.g. DIAMOND). |
addRaw(Map❮String, Object❯ rawBlock) | Escape hatch for every other block type/property — pass a raw block map using the same keys the editor writes to disk (type, id, position.x/y, size.width/height, onClick, ...). |
Builder conventions: element ids are auto-generated (element_1, element_2, ...) when left blank; every element is created with enabled: true and opacity: 255; layers are assigned automatically in add order (10, 20, 30, ...), so elements added later render on top. Hex colors are accepted with or without the leading #. Page names are normalized like regular page names, and reserved internal names (e.g. the editor pages) are rejected by saveGui.
Example#
UltimateUIAPI api = UltimateUIAPI.get();
UiBuilder builder = api.createGui("daily_rewards")
.screenSize(1920, 1080)
.addBlock("background", 660, 240, 600, 600, "#101418")
.addText("title", "<bold>Daily Rewards</bold>", 760, 280, 400, 48, "#ffd966")
.addText("subtitle", "Come back tomorrow for more!", 760, 340)
.addItem("reward_icon", "DIAMOND", 910, 460, 100, 100);
api.openGui(player, builder); // saves pages/daily_rewards.yml and opens it
// api.saveGui(builder); // or just persist it without opening
// api.openGuiHud(player, builder, true); // or open as an auto-closing HUD overlay