Skip to main content

Display & Usage Conditions

EasyMenu 7 provides distinct controls for whether a menu can be opened (open-when), whether an item is visible (visible-when), and whether an item is clickable (enabled-when).


3 Condition Scopes Compared​

open-when → Can the player open the menu?
visible-when → Is the item visible on the menu?
enabled-when → Can the player click the item?
Configuration KeyLocationPurposeBehavior When False
open-whenMenu levelPrevents players lacking permissions/conditions from opening the menu entirelyMenu does not open; sends open-denied-message to player.
visible-whenItem level (menu-items)Hides element completely from players lacking accessElement is omitted from the UI (remains an empty slot / background).
enabled-whenItem level (menu-items)Shows item requirements while refusing execution if unmetItem displays normally, but clicking emits disabled-message without executing actions.

When open-denied-message or disabled-message is omitted, the language file's menu.open-denied / menu.element-disabled is used. Both support color codes and placeholders.


Examples​

1. open-when (Menu Admission Control)​

Menu accessible only to players holding the VIP permission node. Regular players attempting to open via /menu or /shop are refused:

plugins/EasyMenu/sub/vip_shop.yml
menu-title: "&d&lVIP Shop"
menu-size: 27

# Only accessible to VIP players
open-when:
permission: "myserver.vip"
open-denied-message: "&cThis menu is exclusive to VIP players."

menu-items:
- slot: 13
material: NETHERITE_INGOT
name: "&5VIP Perk Item"
command: "vip claim"

2. visible-when (Hiding Admin Buttons)​

Button visible only to staff members holding the admin permission node:

menu-items:
- slot: 26
material: BEDROCK
name: "&c&lStaff Panel"
lore:
- "&7Click to open staff tools"
visible-when:
permission: "myserver.admin"
command: "sub_admin_panel"

3. enabled-when (Economy Shop Purchase Check)​

Visible to everyone, but clicking fails with a message if the player has less than 1,000 balance:

menu-items:
- slot: 13
material: DIAMOND
name: "&bBuy Diamond"
lore:
- "&7Price: &e$1,000"
- "&7Your Balance: &a$%vault_eco_balance%"
enabled-when:
placeholder:
value: "%vault_eco_balance%"
operator: ">="
compare: "1000"
disabled-message: "&cInsufficient funds! (Price: $1,000 / Balance: $%vault_eco_balance%)"
command: "shop buy diamond"

Re-evaluation on Click for Security​

Player balances, ranks, and worlds can change while a menu is open.

EasyMenu 7 re-evaluates both visible-when and enabled-when conditions at the exact moment a player clicks the item, in addition to when the menu is drawn.

This rejects purchase actions when the conditions no longer hold at click time. The destination plugin executes purchases and updates balances, so this is not a guarantee against every race involving those operations.