GUIs
The plugin features a powerful and intuitive GUI creator to build interactive menus for your players, which can be used for enchanting, shops, navigation, and more.
Creating a GUI
Create a new .yml
file in plugins/EdTools/guis/
. The filename becomes the GUI's unique ID.
Example: guis/hoe-enchants.yml
# The title displayed at the top of the GUI. Supports color codes.
title: '&8Hoe Enchantments'
# The number of rows for the inventory. Must be between 1 and 6.
rows: 6
# The sound to play when the GUI is opened.
open-sound: 'BLOCK_CHEST_OPEN'
# Optional: A permission required to open this GUI.
# permission: 'edtools.gui.crop'
# This section defines every item inside the GUI.
contents:
# The key 'black-glass' is a unique identifier for this item within the GUI.
'black-glass':
material: 'BLACK_STAINED_GLASS_PANE'
name: '&f'
slots: '0-53' # You can define single slots (e.g., '4') or ranges ('0-8').
'mining-pickaxe':
material: 'WOODEN_PICKAXE'
name: '&e&lMining Pickaxe'
lore:
- '&aClick here to switch to the Mining Pickaxe Tool'
slots: '5'
# Actions to run on any click type (left, right, middle, etc.).
any-click-actions:
- '[swaptool] pickaxe-tool' # Switches the player's held OmniTool
- '[menu] pickaxe' # Opens the 'pickaxe' GUI
'fortune-enchant':
slots: '10'
material: '%edtools_enchant_material_crop-fortune%' # Material can be dynamic
name: '&9&lꜰᴏʀᴛᴜɴᴇ &d&lᴇɴᴄʜᴀɴᴛ'
lore:
# Lore can use placeholders and supports conditional logic.
- 'if(%edtools_leveling_level_crop-level% >= 5) then &9[CLICK TO UPGRADE]'
- 'if(%edtools_leveling_level_crop-level% < 5) then &c[REQUIRES HOE LEVEL 5]'
# A requirement that must be met for the click actions to fire.
# Uses PlaceholderAPI placeholders.
click-requirement: '%edtools_leveling_level_crop-level% >= 5'
any-click-actions:
# Opens another menu, passing context for what is being upgraded.
- '[menu] upgrade-enchant enchant crop-fortune'
GUI Actions
Actions are commands executed when a player clicks an item. They are defined in a list under keys like any-click-actions
, left-click-actions
, right-click-actions
, etc. The format is [action] <arguments>
.
Here is a list of all registered actions:
[command] <command>
: Makes the player execute a command.[console] <command>
: Executes a command from the server console. Placeholders{player}
,{uuid}
, and{world}
will be replaced.[swapzoneblocks] <zoneId> <zoneBlock>
: Changes the block type for a player within a specific regeneration zone.[close]
: Closes the current GUI for the player.[message] <message>
: Sends a formatted message to the player. Supports color codes and PlaceholderAPI.[menu] <menuName> [placeholder1] [value1]...
: Opens another GUI. You can pass key-value pairs to be used as placeholders in the target menu.[enable-enchant] <enchant>
: Enables a specific enchantment for the player.[disable-enchant] <enchant>
: Disables a specific enchantment for the player.[upgrade-enchant] <enchant> <amount>
: Upgrades a specified enchantment for the player by a given amount.[swaptool] <tool>
: Swaps the player's active OmniTool to the one specified.[sound] <sound_name> [volume] [pitch]
: Plays a sound for the player. Volume and pitch are optional (default to 1.0).[broadcast] <message>
: Broadcasts a message to all players on the server.[title] <title> <subtitle> [fadeIn] [stay] [fadeOut]
: Sends a title and subtitle to the player. The time values are optional.[permission] <permission> <successAction> [failAction]
: Checks if the player has a permission. ExecutessuccessAction
if they do, andfailAction
if they don't. The actions must be a single string (e.g.,'[message] You have permission!'
).
Was this helpful?