box-openMenu Examples

Real-world examples demonstrating various menu features and patterns.

Example 1: Simple Shop Menu

circle-info

Use Case: A basic shop where players can purchase items with currency validation.

shop.yml
inventory:
  title: '&8Shop - Page {page}'
  slots: 27
  
  variables:
    page: '1'
  
  on-open:
    - '[sound] BLOCK_CHEST_OPEN 1.0 1.0'
  
  fillers:
    border:
      slots: [0, 1, 7, 8, 18, 19, 25, 26]
      material: 'GRAY_STAINED_GLASS_PANE'
      name: ' '
  
  menu-items:
    'item-1':
      slot: '10'
      material: 'DIAMOND'
      name: '&b&lDiamond Pack'
      lore:
        - '&7Price: &f1,000 Coins'
        - ''
        - 'if(%vault_eco_balance% >= 1000) then &a✓ Click to purchase!'
        - 'if(%vault_eco_balance% < 1000) then &c✗ Insufficient funds'
      
      # Only clickable if player has money
      click-requirement: '%vault_eco_balance% >= 1000'
      
      any-click-actions:
        - '[console] eco take %player% 1000'
        - '[console] give %player% diamond 64'
        - '[sound] ENTITY_PLAYER_LEVELUP 1.0 1.0'
        - '[message] &a&lPurchased! &7You received &b64 Diamonds'
        - '[menu] shop page 1'  # Refresh menu
    
    'item-2':
      slot: '11'
      material: 'EMERALD'
      name: '&a&lEmerald Pack'
      lore:
        - '&7Price: &f5,000 Coins'
        - ''
        - 'if(%vault_eco_balance% >= 5000) then &a✓ Click to purchase!'
        - 'if(%vault_eco_balance% < 5000) then &c✗ Insufficient funds'
      
      click-requirement: '%vault_eco_balance% >= 5000'
      
      any-click-actions:
        - '[console] eco take %player% 5000'
        - '[console] give %player% emerald 64'
        - '[sound] ENTITY_PLAYER_LEVELUP 1.0 1.0'
        - '[message] &a&lPurchased! &7You received &a64 Emeralds'
        - '[menu] shop page 1'
    
    'close':
      slot: '26'
      material: 'BARRIER'
      name: '&c&lClose'
      lore:
        - '&7Click to close this menu'
      
      any-click-actions:
        - '[sound] BLOCK_CHEST_CLOSE 1.0 1.0'
        - '[close]'

Last updated