Menu files
Every menu is one YAML file in plugins/Reticle/menus/. The file name is the menu's name: shop.yml holds the menu shop, which commands and actions refer to. Name new menus with lowercase letters, digits, _ and -, at most 32 of them, since the editor and the API create no other names.
Run /reticle reload after you change a file. Menus saved in the editor take effect at once.
This is the example main.yml that Reticle creates:
# The menu's size in pixels, at most 480 by 270.
Size: [320, 140]
# The title shown at the top. Remove the line for a menu without a title.
Title: "Main menu"
# How large the title is drawn, a whole number from 1 to 4.
Title_Scale: 2
# dark or light.
Theme: dark
Elements:
play:
Type: button
Position: [12, 44]
Size: [296, 40]
Text: "Play"
Subtitle: "Pick a game and jump in"
Icon: DIAMOND_SWORD
Icon_Background: "#FF9F0A"
Actions:
- close
- "message: <aqua>Good luck, {player}!"
shop:
Type: button
Position: [12, 88]
Size: [296, 40]
Text: "Shop"
Subtitle: "Swords, food and more"
Icon: EMERALD
Icon_Background: "#BF5AF2"
Actions:
- "open: shop"
close:
Type: button
Position: [284, 8]
Size: [24, 24]
Text: "×"
Text_Scale: 2
Hover: "#FF453A"
Actions:
- closeMenu keys
| Key | Default | What it does |
|---|---|---|
Size | required | [width, height] in menu pixels: 32 to 480 wide, 32 to 270 high |
Title | none | Text centered at the top, its capitals centered 20 pixels below the top edge. Start your elements about 40 pixels down |
Title_Scale | 1 | The size of the title: how many menu pixels one pixel of the font takes, a whole number from 1 to 4. It needs Title |
Theme | dark | dark or light: the colors of the menu and of every element without colors of its own |
Permission | none | The permission a player needs to open the menu with its command or with /reticle open |
Command | none | A list of commands that open the menu, see Command and permission |
Refresh | none | Ticks between redraws of texts that hold placeholders, from 2 to 72000 (one hour), see Placeholders |
Elements | required | The elements, each under a name you choose |
Keys are case sensitive. Reticle refuses any other key, and the menu does not load.
Elements
Each element sits under its own name in Elements, such as play above, made of letters, digits, _ and -, at most 32 of them. Plugins see that name through the API. Every element needs three keys:
| Key | What it does |
|---|---|
Type | panel, text, button, item, input or map |
Position | [x, y] of its top left corner, counted from the top left corner of the menu |
Size | [width, height] |
Positions and sizes are whole numbers in menu pixels, and every element must lie inside the menu. At Text_Scale: 1 one pixel of Minecraft's font is one menu pixel: capitals are 7 pixels high, and lines sit 10 pixels apart. When clickable elements overlap, the one further down in the file takes the click. An element accepts only the keys its type lists below.
panel
A filled rectangle. It cannot be clicked. Panels always lie behind buttons, texts and icons, whatever their order in the file, and a panel further down in the file lies over the ones above it, so you can put a card panel on a larger one. A menu holds at most 32 panels.
Keys: Background.
strip:
Type: panel
Position: [0, 184]
Size: [300, 8]
Background: "#0A84FF"text
One or more lines of text, centered in the box unless you set Align. Text does not wrap, so start each new line with \n inside double quotes. With Actions the text becomes clickable and gets a background and a hover color like a button. Without them, a Background you set still fills the box behind the text, and Hover has no effect.
Align: left or Align: right moves the text to that side. On a background the letters keep the same distance from the side as from the top of the box; without one they start right at the edge.
Keys: Text (required), Text_Scale, Align, Color, Background, Hover, Actions.
welcome:
Type: text
Position: [16, 40]
Size: [268, 24]
Text: "Welcome back, {player}"
Color: "#98989D"button
Text, an icon or both on a background. A button needs Actions to react to the pointer, and without them it has no background unless you give it one.
A button with an icon is laid out as a row. The icon stands at the left, as far from the left edge as from the top, and the text starts 8 pixels after it, so the texts of buttons stacked under each other line up. Align: center centers the text on the whole button instead, so on a button centered in the menu it lines up with the title, and Align: right ends it as far from the right edge as the icon stands from the left. A button without an icon centers its text. With Align: left or right its text keeps the same distance from the side as from the top, or starts at the edge when the button has no background.
Subtitle adds one more line under the text, in the theme's gray, with the same alignment. The two lines are centered together from top to bottom. Icon_Background draws a square tile behind the icon, 4 pixels larger than the icon on every side, and then the tile stands where the icon would.
Keys: Text, Subtitle, Text_Scale, Align, Color, Icon, Icon_Background, Background, Hover, Actions. It needs Text, Icon or both. Subtitle needs Text, and Icon_Background needs Icon.
starter:
Type: button
Position: [16, 40]
Size: [268, 40]
Text: "Starter"
Subtitle: "Free every day"
Icon: WOODEN_SWORD
Icon_Background: "#3A3A3C"
Actions:
- "command: kit starter"item
One icon, centered in the box. With Icon_Background a square tile sits behind it, 4 pixels larger on every side. With Actions it becomes clickable. Without them, a Background you set still fills the box behind the icon, and Hover has no effect.
Keys: Icon (required), Icon_Background, Background, Hover, Actions.
gem:
Type: item
Position: [130, 40]
Size: [40, 40]
Icon: EMERALDinput
A field the player types into. It shows its Text in the theme's gray until he has typed something. That text and the typed value stand at the left, as far from the side as from the top, unless you set Align. A click opens a Minecraft dialog with a text field and the buttons Done and Cancel. Done puts the value into the field and runs the element's Actions, where {value} stands for what he typed. The value stays while the menu is open, and the next click starts from it.
Keys: Text (required), Text_Scale, Align, Color (the typed value), Background, Hover, Max_Length, Actions.
nickname:
Type: input
Position: [16, 40]
Size: [208, 40]
Text: "Type a nickname"
Max_Length: 16
Actions:
- "command: nick {value}"map
A map of the land around the player, which he moves with clicks, the keys W, A, S and D and the mouse wheel, see Maps. Its size goes in steps of 16 pixels, a menu holds one map, and only panels may lie under it.
Keys: Shape, Zoom, Markers, Background, Frame and Compass.
map:
Type: map
Position: [16, 40]
Size: [288, 176]
Zoom: 1
Background: "#1C1C1E"Element keys
| Key | Types | Default | Values |
|---|---|---|---|
Text | text, button, input | none | Text with MiniMessage tags such as <red>, <b> or <#FFAA00>. Reticle does not read & color codes, see How text is placed |
Subtitle | button | none | A line under Text in the theme's gray, with the same tags and placeholders |
Text_Scale | text, button, input | 1 | A whole number from 1 to 8: how many menu pixels one pixel of the font takes |
Align | text, button, input | left on inputs and on buttons with an icon, center on the rest | left, center or right |
Color | text, button, input | the theme's text color | #RRGGBB |
Icon | button, item | none | An item name such as DIAMOND_SWORD, see Icons |
Icon_Background | button, item | none | #RRGGBB or #AARRGGBB, the tile behind the icon |
Background | all | the theme's surface on panels and clickable elements, none on the rest | #RRGGBB or #AARRGGBB. On a map, #RRGGBB for the land it has no terrain for |
Hover | text, button, item, input | the theme's accent | #RRGGBB or #AARRGGBB |
Max_Length | input | 32 | 1 to 256 letters |
Actions | text, button, item, input | none | A list, see Actions |
Shape | map | square | square or round |
Zoom | map | 1 | Map pixels per block: 8, 6, 4, 2, 1 or 0.5 |
Markers | map | all four | A list of waypoints, pins, players and mobs |
Frame | map | none | #RRGGBB, a line one pixel wide along the edge of the map |
Compass | map | false | true puts an N for north on the ring of a round map |
Rotate | map on a HUD | false | true turns a round minimap with the player, see Heading up |
Colors and themes
Colors are hex codes: #RRGGBB, or #AARRGGBB with the opacity first. Put them in quotes, because # starts a comment in YAML. Color takes no opacity, since Minecraft draws text either fully or not at all. For Background and Hover, Reticle refuses an opacity from 01 to 19, which Minecraft would not draw; use 00 for none, or 1A (10 percent) and above.
A click paints the element in its hover color darkened to 70 percent for three ticks. While an element is hovered or pressed, its text and subtitle in the theme's colors turn white or black, whichever reads better on its hover color, so a gray subtitle stays legible on the blue hover. Text with its own Color keeps it.
The theme colors every element that sets no color of its own:
| Part | dark | light |
|---|---|---|
| Menu background | #1C1C1E | #F2F2F7 |
| Surface of panels and clickable elements | #2C2C2E | #FFFFFF |
| Accent, the default hover color | #0A84FF | #007AFF |
| Text and title | #FFFFFF | #000000 |
| Subtitles, and an input before anything is typed | #98989D | #6C6C70 |
Icons
Icon takes an item name such as DIAMOND_SWORD, EMERALD or OAK_LOG. The item needs a flat picture of its own among the game's textures, which many items and blocks have. Reticle refuses the others, such as CHEST:
'CHEST' in element 'loot' of menu 'shop' has no flat picture to show. Pick an item with its own picture, for example DIAMOND_SWORD, EMERALD or OAK_LOG.The pictures come from the textures in the player's own game, so icons need no resource pack. In the chest menu the icon is the real item.
An icon takes 60 percent of the button's height, or of the item's shorter side, rounded down to a multiple of 8 pixels and never below 8, so every pixel of the picture keeps the same size: a 40 pixel button gets a 24 pixel icon, a 32 pixel button a 16 pixel one. Reticle refuses an element too small for its icon, or for the icon and its tile.
How text is placed
Reticle measures every text with the letter widths of Minecraft's own font before it places it, so a centered text sits in the middle of its box and left aligned rows start on the same pixel. A text in another font cannot be measured, so Reticle refuses <font> tags, and also tags that the player's game fills in itself, such as <lang> and <key>. It refuses § color codes too, which MiniMessage does not read; use tags such as <red> instead. Placeholder values may hold § codes and are measured with them.
Text sizes are whole numbers because Minecraft draws a font pixel at a fractional size with uneven screen pixels, which shows as thin seams inside bold letters.
Actions
Actions is a list that runs from top to bottom on every click. Each entry is the name of an action, followed by a colon and a value when the action takes one:
| Action | What it does |
|---|---|
close | Closes the menu |
back | Returns to the menu before, or closes the menu when there is none |
open: <menu> | Opens another menu; back and sneaking return from it |
command: <command> | The player runs the command, with or without the leading slash |
console: <command> | The console runs the command |
message: <text> | Sends the player a chat message, with MiniMessage tags |
sound: <sound> [volume] [pitch] | Plays a sound to the player; volume and pitch are 1 unless you give them |
server: <server> | Sends the player to another server of your BungeeCord or Velocity network |
map: <move> | Moves the menu's map: zoom in, zoom out, pan north, pan south, pan east, pan west or center, see World map in a menu |
Actions:
- "sound: entity.experience_orb.pickup 0.6 1.2"
- "console: give {player} diamond 1"
- "message: <green>Here is your diamond, {player}."
- close- Put every action that has a value in double quotes, as above. YAML reads an unquoted
- open: shopas a key with a value, and the menu does not load. - Once
closehas run, a laterbackorclosedoes nothing. Commands, messages, sounds andserverstill run, andopenstill opens the other menu. soundtakes a sound key such asui.button.click. Reticle checks that the key is well formed, and a sound that does not exist plays nothing.serveruses the BungeeCord plugin channel. Velocity understands it whilebungee-plugin-message-channelistrueinvelocity.toml, which is its default.- In shader and world mode a player can click once every four ticks, and faster clicks are ignored.
Placeholders
| Placeholder | Works in | Becomes |
|---|---|---|
{player} | texts, titles, message, command, console | The player's name |
{uuid} | command, console | The player's UUID |
{value} | message, command, console of an input | What the player typed |
{x}, {y} and {z} | texts, titles, message, HUD Fallback lines | The block the player stands on |
%placeholder% | texts, titles, message, command, console | Its PlaceholderAPI value, when PlaceholderAPI is installed |
Values go in as plain text. MiniMessage tags inside a value, or typed by a player, show as they are.
In command and console, a typed value or a PlaceholderAPI value may hold only letters, digits and _ . : + -. Otherwise the command does not run, and the console says:
Refused to run 'nick {value}' for Steve: the typed value 'Big Steve' may only hold letters, digits and _ . : + -Texts take their placeholder values when the menu is drawn. With Refresh: 20, every title and text that holds % or { is drawn again each second while the menu is open. The chest menu does not refresh.
Command and permission
Command: [shop, store]
Permission: myserver.menu.shopCommandtakes names without the slash, made of lowercase letters, digits,_and-. Reticle registers them while the menu is loaded, and only players can use them.- Without
Permission, every player may use the menu's commands. With it, a player needs that permission for the commands and for/reticle open shop, which also needsreticle.command.open. - Reticle does not check the permission when an
openaction in another menu leads here, when a plugin opens the menu through the API, or when the console runs/reticle open shop Steve. Put buttons that lead to a protected menu only into menus that the right players can open. - When another plugin or Minecraft already has a command of that name, the other command keeps it, and the menu's command answers to
/reticle:shop.
When a menu does not load
Reticle checks every menu file when the server starts and on /reticle reload. A file with a mistake stays out, the other menus load, and the console names the problem:
Menu shop is not loaded: 'Size' in menu 'shop' must be between 32x32 and 480x270, got 500x192. Fix menus/shop.yml, then run /reticle reload.Fix the file as the line says and run /reticle reload. Other mistakes read like these:
| Message | Fix |
|---|---|
Unknown key 'Titel' in menu 'shop'. Allowed: Size, Title, Theme, Permission, Command, Refresh, Elements. | Correct the spelling |
Unknown key 'Icon' in element 'note' of menu 'shop'. Allowed for text: Actions, Align, Background, Color, Hover, Position, Size, Text, Text_Scale, Type. | Remove the key, or change the type |
'Text_Scale' in element 'note' of menu 'shop' must be a whole number from 1 to 8, got '1.5'. | Use a whole number |
The text of element 'note' of menu 'shop' uses the font 'minecraft:uniform'. Reticle places text by measuring it in Minecraft's default font, so remove the <font> tag. | Remove the <font> tag |
The text of element 'note' of menu 'shop' is not valid MiniMessage: Legacy formatting codes have been detected in a MiniMessage string ... | Replace § codes with tags such as <red> |
Element 'gem' of menu 'shop' is 12x12, too small for its icon tile of 16x16 pixels. Make it at least 16 pixels high and wide. | Make the element larger, or remove Icon_Background |
Element 'buy' of menu 'shop' does not fit the menu: it spans 16,40 to 316,80 but the menu is 300x192. | Move or shrink the element |
The element Id 'buy now' in menu 'shop' may only hold letters, digits, _ and -, at most 32 of them. | Rename the element, for example to buy-now |
Set 'Text' in element 'note' of menu 'shop'. | Text and input elements need Text, buttons need Text or Icon |
'Color' in element 'note' of menu 'shop' takes #RRGGBB: Minecraft draws text either fully or not at all, so it has no alpha. | Leave out the two opacity digits |
Unknown action 'teleport' in element 'buy' of menu 'shop'. Available: close, back, open, command, console, message, sound, server, map. | Use one of the listed actions |
'Refresh' in menu 'shop' is in ticks and must be from 2 to 72000 (one hour), got 100000. Remove the key to never refresh. | Use a smaller number, or remove the key |
'Elements' in menu 'shop' holds 33 panels, at most 32 are allowed. Merge panels that sit side by side into one. | Merge neighboring panels |
Action 'open' in element 'buy' of menu 'shop' needs a value, for example 'open: ...'. | Add the value after the colon |
An open action that names a missing menu does not stop the menu from loading, but the console warns:
Menu help, element rules: action 'open: rules' points to a menu that does not exist. Available: help, main, shop.A file that is not valid YAML stays out the same way when the server starts. /reticle reload checks every file in the plugin folder first, and when one is not valid YAML it reloads nothing and names that file in chat, with the details in the console.
Reticle writes the two examples main.yml and shop.yml again only when the whole menus folder is missing.
