Menu API
Create Minecraft GUIs quickly, and efficiently.
The Menu API is meant to make the hassle of creating Minecraft GUIs easier. From being able to create a Menu with code, or a configuration section. The Menu API makes it easier than ever.
Each page in this wiki will have a section for relevant classes, and a link to them on GitHub. As well as examples for defining & using the specified feature using a configuration file and from code.

Examples

Configuration Menu
Code Menu

Menu Syntax

You can load a Menu straight from a configuration file using the Menu API.
Simply define the Menu in a valid syntax such as:
# All keys defined in this example are case-sensitive.
# Example: Title MUST be defined as Title, not title
Example-Menu: # Menu configuration key, this can be defined as anything
Title: "&eExample Menu" # This will be the Menu's title
Size: 9 # This will be the Menu's size, must be multiple of nine
Items:
Example-Item:
Slot: 0 # The slot to place the item, starts with 0
Material: "GRAY_STAINED_GLASS_PANE" # The material of the ItemStack
Name: "&cExample" # The name of the ItemStack, supports colors
Lore: # The lore of the ItemStack, supports colors
- "&7Example Item"
- ""
- "&aSecond Line"
# These are a set of actions that run when
# clicking on the ItemStack. View more
# information later in documenation
Actions:
# This action runs a command as the player
- "RUN_PLAYER_COMMAND:examplecommand withargs"

Loading The Menu

Loading a Menu can be done as followed:
Player somePlayer;
FileConfiguration someConfig;
Menu exampleMenu = new MenuBuilder().fromConfiguration(someConfig
.getConfigurationSection("Example-Menu")).getMenu();
// Display "Global" Menu
// This Menu is shared between players. Any modifications will be
// able to be see by all players.
//
// Mainly useful for a static Menu, such as a help menu.
somePlayer.openInventory(exampleMenu.getInventory());
// Display "User" Menu
// This Menu is not shared between players. It is unique to each
// individual player, and thus can be modified and use per-player
// placeholders.
//
// Has many, many uses.
somePlayer.openInventory(exampleMenu.getUserMenu(somePlayer));
Creating a Menu in code is just as simple as using a configuration.
Menu exampleMenu = new MenuBuilder("&eExample Menu", 9).getMenu();
Copy link