Skip to main content

Menus and own commands

Module menus. Settings files: menus.toml (enabled, clickSound), menus/, commands.toml (enabled), commands.json.

Commands​

CommandWhat it doesPermissionDefault
/menu <name>Open a menu from config/britaessentials/menus/brita.essentials.menus, plus the menu's own permissioneveryone
own commandsCommands you define in commands.jsonthe command's own permissioneveryone
/brita reloadReload menus, own commands and textsoperatoroperators

Each file config/britaessentials/menus/<name>.json is a chest menu, opened with /menu <name>. On the first start the mod writes two examples, example and tips. The warps, homes and player warps menus are menu files too. How to write one: Menu files.

Own commands​

commands.json defines commands such as /discord or /hub. Each command does a list of menu actions in order: [player] command, [console] command, [message] text, [menu] name, [close]. On the first start the mod writes an example with /discord (also /dc) and /whois. After changing the file run /brita reload: the new commands work at once, also in tab completion.

{"commands": {
"example": {"aliases": ["ex"], "actions": ["[menu] example"]},
"hub": {"description": "Sends you to the lobby.", "permission": "brita.cmd.hub",
"usage": "<world>", "actions": ["[console] execute in {0} run tp {player} 0 80 0"]}
}}
OptionWhat it does
actionsWhat the command does, in order (required)
permissionOnly players with this permission see and use the command; empty for everyone
aliasesMore names for the same command
descriptionShown, with usage, when a player leaves out needed words
usageThe words after the command, such as <nickname>; default <1> <2>
  • Names and aliases use a-z, 0-9, - and _. A name that another command (of Minecraft or any mod) already has is never replaced: it is skipped and reported in the server log.
  • {player} is the player's name; {0}, {1} and so on are the words typed after the command. A command using {1} asks for two words.
  • Words used in [player] or [console] may hold only letters, numbers and _ - . : # +, so nobody can slip selectors such as @a into a console command. In [message] any word works.
  • A command taken out of the file disappears after /brita reload. Its name stays reserved until the server restarts, so another mod cannot take it over in between.
  • permission works like in menu files: LuckPerms decides, otherwise only operators have it. Players see a permission change in their tab completion after rejoining or /brita reload.
  • With the economy module, a command can cost money: add its name under costs in economy.json.