Variants
Variants allow an element to change its visual appearance (name, material, lore) or its executed command dynamically based on the viewing player's conditions.
Example: VIP Discount Override
Show standard pricing ($1,000) to regular players, but display discounted VIP pricing ($500) and run a VIP-specific command for VIPs:
menu-items:
- id: buy_diamond
slot: 13
material: DIAMOND
name: "&bBuy Diamond"
lore:
- "&7Standard Price: &e$1,000"
command: "shop buy diamond standard"
# Variant overrides
variants:
- id: vip_discount
when:
permission: "myserver.vip"
override:
name: "&d&l[VIP] Buy Diamond (50% OFF!)"
lore:
- "&7VIP Price: &a$500"
- "&dVIP perk active"
glint: true
command: "shop buy diamond vip"
Evaluation & Override Rules
- Top-to-Bottom First Match: The
variantslist is evaluated sequentially; the first variant whosewhencondition holds is applied. - Selective Key Overrides: Only keys specified inside
overrideare replaced; unmentioned properties (slot,material, etc.) are inherited from the base element. - Clean Action Replacement: If
overridespecifies any ofcommand,action, oractions, the base action definitions are completely replaced rather than merged. - Session Binding: The selected variant is determined when the menu opens and stays fixed for that session, ensuring that what the player sees always matches what clicking will execute.
:::note No Nesting Variants cannot be nested inside other variants. :::
Validation at Reload
All variant overrides are parsed and validated identically to base items during /menu reload.
If an override references an unknown material or invalid action, reload is rejected immediately. Errors never linger until a player meets the condition.