stack-overflowMenu Variables

circle-check

Built-in Variables

Some variables are automatically provided by the system:

Variable
Description
Example Value

{sword}

Current sword skin ID (when opening sword menus)

wooden-sword

{player}

Player's username

Notch

circle-exclamation

Custom Variables

You can define your own variables in three ways:

1

Default Values in Config

Set defaults that apply when the menu opens:

inventory:
  variables:
    sword_tier: '1'
    enchant_id: 'speed'
    player_balance: '0'
2

Pass When Opening Menu

Pass variables via the [menu] action:

any-click-actions:
  - '[menu] upgrade-menu sword_tier 5 enchant_id critical'

Format: [menu] menu-id [key1 value1 key2 value2...]

3

Set During Execution

Use the [set-variable] action (if implemented):

any-click-actions:
  - '[set-variable] current_page 2'
  - '[menu] next-page'

Using Variables

Reference variables with curly braces: {variable_name}

title: '&8Sword Details - Tier {tier}'

Variable Inheritance

Variables follow a hierarchical inheritance model:

Example Flow:


PlaceholderAPI Integration

circle-info

Yes! PlaceholderAPI placeholders work everywhere variables do.

You can mix variables and PlaceholderAPI:

Processing Order

1

Variables are replaced first: {variable}value

2

PlaceholderAPI is processed next: %placeholder%result

3

Color codes are applied last: &a → green color


Advanced Examples

Multi-Menu Workflow

Create a wizard-style flow by passing variables between menus:

Troubleshooting

chevron-rightVariable Not Showinghashtag

Problem: {variable} appears as literal text

Solutions:

  • Check spelling matches exactly

  • Ensure variable was passed to the menu

  • Verify variable exists in parent context

chevron-rightVariable is Emptyhashtag

Problem: Variable resolves to empty string

Solutions:

  • Set default value in menu config

  • Check if parent menu passed the variable

  • Use PlaceholderAPI if fetching player data

chevron-rightPlaceholderAPI Not Workinghashtag

Problem: %placeholder% not resolving

Solutions:

  • Ensure PlaceholderAPI is installed

  • Check expansion is installed (/papi ecloud)

  • Verify placeholder syntax is correct


Quick Reference

Concept
Syntax
Example

Reference Variable

{variable_name}

{tier}

Set Default

variables: key: 'value'

tier: '1'

Pass Variable

[menu] id key value

[menu] shop tier 5

PlaceholderAPI

%expansion_placeholder%

%player_level%

Combined Usage

{var} %papi%

{tier} %vault_eco_balance%

Last updated