Skip to content

How to create a menu

Menu author

A short tour through the basic features. By the end of this page you’ll have a working menu opened by a command, with a button that takes money and gives an item.

All menu files sit under plugins/AbstractMenus/menus/. The plugin walks the folder recursively, so nesting subfolders for organisation is fine - the file name (without extension) becomes the menu’s unique id.

  • Directoryplugins/AbstractMenus
    • config.conf the global plugin config
    • Directorymenus
      • menu.conf created on first run
      • shop.conf
      • Directorycasino
        • blackjack.conf nested folders are fine
        • slots.conf
    • variables.db SQLite, do not edit by hand
  1. Create the file

    Make plugins/AbstractMenus/menus/menu.conf. The two required keys are title and size.

    menus/menu.conf
    title: "My first menu"
    size: 6
    • title - shown at the top of the inventory.
    • size - number of inventory rows (1 to 6).

    Run /am reload. The console prints:

    [AbstractMenus] Loaded 1 menus
  2. Add an activator so players can open it

    An activator is anything that opens the menu - a command, an item interaction, joining the server, walking into a region, and so on. The simplest is command:

    menus/menu.conf
    title: "My first menu"
    size: 6
    activators {
    command: "mymenu"
    }

    /am reload, then in chat: /mymenu. An empty menu opens.

    Empty menu we created

  3. Place a button

    Buttons are entries in an items: [...] list. Each entry lives at a slot and has a material.

    menus/menu.conf
    title: "My first menu"
    size: 6
    activators {
    command: "mymenu"
    }
    items: [
    {
    slot: 0
    material: DIAMOND_SWORD
    name: "&6Excalibur"
    }
    ]

    Menu with the Excalibur button

  4. Make the button do something on click

    The click block is a list of actions. Start with closeMenu:

    menus/menu.conf
    title: "My first menu"
    size: 6
    activators {
    command: "mymenu"
    }
    items: [
    {
    slot: 0
    material: DIAMOND_SWORD
    name: "&6Excalibur"
    click {
    closeMenu: true
    }
    }
    ]

    Reload, click the sword, the menu closes. Different mouse buttons can run different actions - see click types for the full list.

Show different buttons to different players

Section titled “Show different buttons to different players”

Add a rules block to an item. Items in the same slot are stacked - the last item whose rules match wins:

items: [
{
slot: 0
material: IRON_SWORD
name: "&6Excalibur"
},
{
slot: 0
material: DIAMOND_SWORD
name: "&6Excalibur"
rules { level: 10 }
}
]

Player at level 9 sees the iron sword. Player at level 10+ sees the diamond one.

click accepts both rules (a check) and actions / denyActions branches:

items: [
{
slot: 0
material: DIAMOND_SWORD
name: "&6Excalibur"
lore: "&7Cost: 100 coins"
click {
rules { money: 100 }
actions {
itemAdd { material: DIAMOND_SWORD, name: "&6Excalibur" }
takeMoney: 100
}
denyActions {
sound: ENTITY_VILLAGER_NO
}
}
}
]

What happens on click:

  1. The player’s balance is checked for 100 coins.
  2. If they have enough, an Excalibur is added to inventory and 100 coins are taken.
  3. If not, a no-villager sound plays.

See logical structures for nested rule trees and inversion.

Rules at the menu root run before the menu opens:

title: "Admin only"
size: 6
rules {
permission: "i.am.admin"
}
denyActions {
message: "&cYou do not have permission to do this!"
}
activators { command: "adminmenu" }

Players without i.am.admin get the message instead of the menu.