Skip to main content

Interactions and navigation

An interaction connects a click on a slot to a behaviour. It is configured on the item, in interactionList.

Add an interaction​

On an item of a layout, add an entry to interactionList:

FieldRole
typeThe click: LEFT_CLICK, RIGHT_CLICK, SHIFT_LEFT_CLICK, SHIFT_RIGHT_CLICK, MIDDLE_CLICK, DOUBLE_CLICK, NUMBER_KEY_1 to NUMBER_KEY_9, DROP, DROP_ALL, SWAP_OFFHAND.
commandsCommands run from the console. %player% is replaced by the player name and PlaceholderAPI placeholders are resolved.
triggersTypeWriter entries to fire for the player.
closeMenuCloses the menu after the action.
executeReturnReopens the previous menu after the action.

The item itself also has triggers and modifiers. They fire on a left or right click, or whenever a specific interaction of the item matches. modifiers change facts, exactly like the modifiers of an action.

The click sound set in audio.onClick plays once per click that did something.

Internal commands​

A command that starts with gui: is handled by GUI:

CommandEffect
gui:closeClose the menu.
gui:backReopen the previous menu.
gui:open <entry_id>, gui:action <entry_id>Fire another entry, typically another Open GUI.
gui:view <view_id>Switch view without closing the window.
gui:page <delta> [layout_id]Change page of a paginated layout.
gui:scroll <dx> <dy> [layout_id]Scroll a scrollable layout.
gui:refreshRedraw the menu.
gui:sound <sound_key>Play a sound key such as minecraft:ui.button.click.

You rarely need to type gui:close and gui:back yourself: tick closeMenu or executeReturn.

Input dialog​

Setting input on an item opens a text dialog when the slot is clicked. The dialog replaces the interactions of that click. Fill title, placeholder, onInputCommands and onInputTriggers. In onInputCommands, {input} is replaced by the typed text and %player% by the player name. The menu is redrawn after the dialog is confirmed.

warning

The field help mentions %value%, but the code replaces {input}. Validate what players type before it reaches a command, an amount or a permission.

Permissions​

  • viewPermission hides the slot.
  • clickPermission keeps the slot visible and removes its interactions, input and triggers.
  • criteria adds a TypeWriter condition.

Use clickPermission to show a locked button with an explanatory lore, and viewPermission to hide it. A blank value gates nothing.

Buttons provided by other extensions​

An item with a buttonType becomes a tagged button. Shops and Quest Codex place such markers; the other extension then replaces the interactions with its own. The tag is buttonPrefix followed by buttonType (for example shop_button: and SHOP_ITEM). If no extension claims the tag, the item keeps the interactions you configured.

Cooldowns and live menus​

cooldownTicks blocks the same slot for that many ticks after a click. autoRefreshTicks on the Open GUI redraws names and lore with their current placeholders every N ticks; keep it at 20 or more for menus that do not need to move.

When a click does nothing​

Check in this order: clickPermission, cooldownTicks, criteria, an input that takes over the click, then the buttonType prefix. A command that needs a player as sender will not work, since commands run from the console.