Menus and Action Tags
On this page(19)
Every SnDungeons menu is a YAML file you can restyle completely. You set the title, the layout, every tile with its name, lore and material, and what a click does. A tile with several looks (locked, unlocked, maxed) is several items on the same cells, each shown when its condition passes. Clicks run action tags, the same tags you use in rewards and actions all over the plugin.
| Core menus | guis/*.yml (menu id = file name) |
| Module menus | modules/<id>/guis/*.yml (menu id = <id>:<file>) |
| Needs | PlaceholderAPI, for the %sndungeons_...% conditions and texts |
| Look switch | menus.back-on-close of config.yml |
How a menu file works
A menu file has a title, a layout drawn with letters, and the items placed on those letters.
guis/settings-hud.yml (part)
title: "Settings - HUD"
# One letter per cell, 9 per row, up to 6 rows.
layout:
- "##HVCA###"
- "#########"
- "##abcde##"
- "####f#g##"
- "#########"
- "R###T####"
strict-clicks: true
# sn:extensible
items:
filler:
material: BLACK_STAINED_GLASS_PANE
display-name: " "
key: '#'
actionbar-on:
material: LIME_DYE
display-name: "&3&lAction &r&b&lBar"
lore:
- "&a&lENABLED"
- "&3Click here to disable."
key: a
view-requirements:
- "%sndungeons_setting_core.action-bars% == on"
click-actions:
- "[settings] toggle core.action-bars"
- "[sound] UI_BUTTON_CLICK"
actionbar-off:
material: GRAY_DYE
display-name: "&3&lAction &r&b&lBar"
lore:
- "&c&lDISABLED"
- "&3Click here to enable."
key: a
view-requirements:
- "%sndungeons_setting_core.action-bars% == off"
click-actions:
- "[settings] toggle core.action-bars"
- "[sound] UI_BUTTON_CLICK"Menu keys
| Key | What it does |
|---|---|
title | The title of the inventory. Color codes and placeholders work |
layout | 1 to 6 rows of up to 9 characters. Each character is a cell; a space is an empty cell. The row count sets the menu size |
strict-clicks | true = only the four mouse clicks (left, right, shift left, shift right) run the actions. Number keys, drop and swap do nothing. The shipped menus use true |
items | The tiles of the menu, by name |
templates | Only in the menus whose tiles the plugin draws from your content files (see Menus drawn from your files) |
open-sound, close-sound | A sound played when the menu opens or closes (SOUND_ID [volume] [pitch]) |
close-actions | Action tags run when the player closes the menu |
update-interval | Ticks between two repaints of the whole menu (0 = none) |
Item keys
| Key | What it does |
|---|---|
key | The layout letter of the item. It shows on every cell with that letter |
slots | Instead of key: slot numbers (4, "0-2", "0, 2, 4-6"). slots wins when both are set |
material | The item type (DIAMOND, PLAYER_HEAD...) |
display-name | The name, with colors and placeholders |
lore | The lines below the name |
amount | The stack size |
glow | true = the enchanted glint |
custom-model-data, item-model | A resource pack model |
skull-owner | The head of a player, for a PLAYER_HEAD ('%sndungeons_player_uuid%' shows the viewer) |
flags | Tooltip flags such as HIDE_ATTRIBUTES |
view-requirements | Conditions to show this item. See Conditions |
click-requirements | Conditions to run the click actions. When they fail, deny-actions run instead |
click-actions | The action tags of a click |
left-click-actions, right-click-actions, shift-left-click-actions, shift-right-click-actions, middle-click-actions | The actions of one click only. A specific list wins over click-actions |
update-interval | Ticks between two repaints of this item (0 = none) |
To remove a button, delete its letter from the layout. The item stays in the file but never shows, with no warning.
States: several items on the same cells
When a tile has several looks, each look is its own item with the same key. The items are tried in
the order of the file: the first whose view-requirements pass owns the cell. An item with no
requirement shows when none of the others does, so put it last.
The shipped settings tiles have five items per cell: on, off, locked-on and locked-off. A
last one shows unavailable, when its module is off.
Conditions
A condition compares two values, usually a placeholder and a word or a number:
view-requirements:
- "%sndungeons_zone_barn_state% == current"
- "%sndungeons_level_level% >= 10 && %sndungeons_perks_enabled% == true"| Operator | Meaning |
|---|---|
== or = | Equal (text ignores case) |
!= | Not equal |
>, <, >=, <= | Numeric comparison |
&&, || | And, or. && binds tighter. Parentheses group |
Several lines must all pass. Put a value in quotes when it holds spaces or operators. A broken line counts as passed, with one console warning, so a typo never locks players out.
The _state placeholders give a stable word made for conditions (locked, current, maxed...).
Their _state_label twin gives the text, from the status: section of the language file. See
Placeholders.
Your items are yours
Every menu's items: carries the # sn:extensible marker. The plugin never adds a tile to your
installed menu and never brings back one you deleted. When a release reshapes a menu, your old
file is moved aside once as old-<file>-<yyyyMMdd-HHmmss>.yml. See
Files and Reloads.
Menus drawn from your files
Some menus show things that have no fixed number. Examples are your totems, your crystals, the
heroes of a folder and the milestones of a category. The plugin draws these tiles itself, with the templates: of the menu.
- You still own the look: every template has its material, name and lore in the file.
- You still own the place: a template's
key:names its cells on the layout. - The plugin fills each template with local values written
{name}, listed in the file's comments.
These menus work this way:
- Core: the booster storage, the luck menu, the shop menus and the upgrades menus.
- Modules: the perks, auras, milestones, totems, attributes, crystals, armors, heroes and hunts menus, with the crystal and totem filters.
Menu ids and opening menus
| Where | Menu id | Example |
|---|---|---|
guis/<file>.yml | <file> | guis/tops.yml is tops |
modules/<id>/guis/<file>.yml | <id>:<file> | modules/zones/guis/stages.yml is zones:stages |
A new file in guis/ is a new menu named after the file. For example, give the level track a
menu by creating guis/level-menu.yml and setting menu: level-menu in levelings/level.yml.
A bare command opens its menu. No command has a menu subcommand. A player who runs /sword,
/zones, /boosts, /rebirth or /tops alone gets its menu. The console gets the help.
The menu of a command is a key of its file. A leveling track uses menu:. boosters.yml,
luck.yml and each module config use commands.main.menu. '' there gives the text answer instead. A key
that names no loaded menu answers that the menu is not available.
[open] <id> opens a menu from a button or a reward. For a SnDungeons menu it runs that menu's
opener. So its permission, its module switch and the state it binds all apply, as with the command.
A menu you added opens as it is.
Back on close
menus:
back-on-close: trueWith true (the default), ESC brings back the menu you came from, as it was. It works when both
are SnDungeons menus. The way back runs the menu's opener again, so its gates apply again.
- The pages of one list (the sword enchant pages, the settings tabs) count as one menu. ESC never walks back through them.
- An Exit or Close button (
[close]) closes everything. So does every close made by the plugin: a zone teleport, a purchase that closes, a quit, a death. - A menu of another plugin or a vanilla inventory ends the chain.
- The perks confirmation is never reopened.
false = ESC closes the menu, as in vanilla. Re-read on /dungeons reload.
The menu look
The shipped menus share one look:
- A plain title, two-tone bold names and a small-caps category line.
┃bullets in anInformation:block, and aCLICK HEREfooter with the hint of the click.ENABLED,DISABLED,LOCKED,MAX LEVELandWARNING:lines for the states.- A black glass filler, a feather Exit (
&c&lExit Menu), an arrow Go Back and tipped arrows for the pages.
It is only the jar's default: every name, lore, material and filler of your installed files is yours.
A button that runs a command as the player ([player] rebirth) asks for the permission of that
command. Rename the button's command when you rename the command.
The shipped menus
Core menus
| File | Id | Opened by |
|---|---|---|
guis/boosts.yml | boosts | /boosts |
guis/booster-backpack.yml | booster-backpack | /boosterbackpack, [booster-backpack] main |
guis/booster-storage.yml | booster-storage | A type tile of the backpack ([booster-backpack] open <type>) |
guis/luck.yml | luck | /luck, [luck] open |
guis/rebirth.yml | rebirth | /rebirth, [leveling] open rebirth |
guis/tops.yml | tops | /tops |
guis/settings-hud.yml | settings-hud | /settings, [settings] open hud |
guis/settings-visuals.yml | settings-visuals | [settings] open visuals |
guis/settings-chat.yml | settings-chat | [settings] open chat |
guis/settings-auto.yml | settings-auto | [settings] open auto |
guis/shop-<currency>.yml | shop-<currency> | /<currency> shop, [shop] open <currency> |
guis/upgrades-<track>.yml | upgrades-<track> | /<track> upgrades, [leveling-upgrades] open <track> |
The shop and upgrades menus are owner files: created once from a template in the jar, then never merged. See Currency Shops and Leveling Upgrades.
Module menus
| Module | Files (modules/<id>/guis/) | Opened by |
|---|---|---|
| zones | zones.yml, stages.yml | /zones, [zones-menu] zones, [zones-menu] stages <zone> |
| zones | visibility.yml | /zone visibility, [zones-menu] visibility |
| sword | tiers.yml | /sword, [sword-menu] open |
| sword | enchants.yml, enchants-2.yml, upgrade.yml | /sword enchants, a right click with the sword, [sword-enchants] open <page>, [sword-enchants] upgrade <enchant> |
| perks | perks.yml, index.yml, confirm.yml | /perks, [perks] open, [perks] index. The confirmation opens before a roll that would replace a marked perk |
| auras | auras.yml, index.yml, upgrades.yml | /auras, [auras] open <auras|index|upgrades> |
| milestones | menu.yml | /milestones, [milestones] open |
| totems | totems.yml, upgrades.yml, skins.yml, filter.yml, bulk.yml | /totems, [totems-menu] main|upgrades|skins|filter|bulk |
| attributes | menu.yml | /attributes, [attributes] open |
| crystals | crystals.yml, filter.yml, bulk.yml | /crystals, [crystals] open|filter|bulk |
| armors | wardrobe.yml, upgrades.yml, skins.yml | /armor, [armors] open <wardrobe|upgrades|skins> |
| autofighter | autofighter.yml, upgrades.yml | /autofighter, [autofighter] open <autofighter|upgrades> |
| afk | afk.yml | /afk, [afk] open afk |
| heroes | heroes.yml, enchants.yml | /heroes, [heroes] open <heroes|enchants> |
| companions | upgrades.yml | /egg upgrades, [companions] open upgrades |
| hunts | menu.yml | /hunt, [hunts] open |
Action tags
An action list is a list of lines, each starting with a tag in brackets. The same tags work in menu clicks, leveling rewards, milestone and hunt rewards, shop entries and more. Placeholders are filled in before the tag runs.
click-actions:
- "[sword-menu] upgrade"
- "[sound] UI_BUTTON_CLICK"A line without a tag runs as [message]. A line with an unknown tag does nothing, with one console
warning. A module's tags exist only while that module is enabled.
General tags (SnLib)
| Tag | Arguments | What it does |
|---|---|---|
[message] | <text> | Sends a chat line to the player |
[broadcastmessage] | <text> | Sends a chat line to the whole server |
[actionbar] | <text> | Shows an action bar. Skipped while the player's core.action-bars setting is off |
[title] | <title>;<subtitle>;<fadeIn>;<stay>;<fadeOut> | Shows a title. Times in ticks (defaults 10, 70, 20). Skipped while core.titles is off |
[sound] | <SOUND> [volume] [pitch] | Plays a sound to the player |
[player] | <command> | Runs a command as the player (their permissions apply) |
[player-as-op] | <command> | Runs a command as the player with operator rights |
[console] | <command> | Runs a command from the console |
[close] | none | Closes the menu (and the whole back-on-close chain) |
[open] | <menu id> | Opens a menu through its opener, with its gates |
[connect] | <server> | Sends the player to another server of your proxy, through the BungeeCord channel |
[particle] | <TYPE> [count] [offX offY offZ] [extra] | Shows a particle at the player |
[potion] | <EFFECT> [seconds] [amplifier] | Gives a potion effect (defaults 10 seconds, amplifier 0) |
[next-page], [previous-page], [set-page] <n>, [refresh-page], [refresh-menu] | Page actions of the paged menus |
Click guards go in front of a tag and run the line only on that click: [left-click],
[right-click], [shift-left-click], [shift-right-click], [middle-click],
[chance=<percent>]... For example: [right-click] [sound] ENTITY_VILLAGER_NO.
SnDungeons reward tags
These change a player's data. Use them in rewards, menus and other plugins' action lists.
| Tag | Arguments | What it does |
|---|---|---|
[give-currency] | <currency> <amount> | Adds to the balance (500, 1.5K and 1e40 work), up to the currency's limit |
[set-currency] | <currency> <amount> | Sets the balance |
[reset-currency] | <currency> | Sets the balance back to the currency's starting value |
[reset-leveling] | <track> | Sets the level of a track back to its starting level |
[reset-upgrades] | <track> [upgrade] | Sets every upgrade of a track (or one) back to 0, with no refund |
[reset-boosters] | [target] | Removes every booster of the player, or those of one target. Never a backpack booster, never a module's own boosters |
[booster] | <type> <multiplier> <time> [amount] | Stores boosters in the player's booster backpack. 2 = a bonus of +2 (x3), x2 = exactly x2 |
[give-pouch] | <currency>:<pouch> [amount] | Gives pouch items, 1 to 2304. What does not fit drops at the player's feet |
[reset-zones] | none | Sets the zone progress back to the first stage of the first zone, then teleports to its spawn (zones) |
[reset-tier] | none | Puts the sword back at the lowest tier (sword) |
[reset-enchants] | none | Sets every sword enchant to level 0 (sword) |
[reset-enchant] | <enchant> | Sets one sword enchant to level 0 (sword) |
[reset-perk] | none | Leaves the player without a perk. Pity, tickets and confirmations stay (perks) |
[give-totem-box] | <tier> [amount] | Gives Totem Box items, 1 to 2304 (totems) |
[give-skin-box] | [amount] | Gives Totem Skin Box items, 1 to 2304 (totems) |
[give-totem] | <type> <tier> [stars] | Puts a rolled totem straight into the player's storage (totems) |
[give-crystal-box] | <tier> [amount] | Gives Crystal Box items, 1 to 2304 (crystals) |
[give-cookie] | <cookie> [amount] | Gives cookie items, 1 to 2304 (cookies) |
Every reset tag is safe to run twice: a second run changes nothing. A broken line does nothing and sends no message, with one console warning. The rewards of a rebirth are the typical place for the reset tags, as in the shipped track:
levelings/rebirth.yml (part)
rewards:
for-each:
- "[reset-leveling] level"
- "[set-currency] money 0"
- "[set-currency] experience 0"
- "[reset-zones]"
- "[reset-tier]"
# Other resets a server may want (remove the # to use one):
# - "[reset-enchants]"
# - "[reset-enchant] critical"
# - "[reset-currency] souls"
# - "[reset-boosters]"
# - "[reset-boosters] damage"
# - "[reset-perk]"
- "[title] &d&lREBIRTH &f{level}"SnDungeons menu tags (core)
Every menu tag runs one tick after the click, one click per player at a time. It checks the permission and switches of the command it mirrors when it runs. A refused click answers with a "not allowed" message.
| Tag | Arguments | What it does |
|---|---|---|
[settings] | toggle <setting> | Switches one setting of the player |
[settings] | all <hud|visuals|chat|auto> | Toggle All: all on when one is off, otherwise all off |
[settings] | reset <hud|visuals|chat|auto> | Puts every setting of that tab back to its default |
[settings] | open <hud|visuals|chat|auto> | Opens a settings tab |
[leveling] | open <track> | Opens the menu of a track |
[leveling] | up <track>, max <track> | Like /<track> up and /<track> max |
[leveling-upgrades] | open <track> | Opens the upgrades menu of a track |
[leveling-upgrades] | buy <track> <upgrade> <amount|max> | Buys up to that many levels (max: as many as the points pay) |
[shop] | open <currency> | Opens the shop of a currency |
[shop] | buy <currency> <entry> | A click buys one unit. A shift click asks how many (shops.bulk-input) |
[booster-backpack] | main | Opens the booster backpack |
[booster-backpack] | open <type> | Opens the storage of one booster type |
[booster-backpack] | start <type>, start-viewed, start-all | Starts a stored booster of a type, of the open storage, or of every type |
[booster-backpack] | end <type>, end-viewed, end-all | Ends a running booster; its time left goes back to the backpack |
[booster-backpack] | deposit | Stores every booster item of the inventory |
[booster-backpack] | withdraw <type> <multiplier> | Takes a booster item out. Left click: one chunk, right click: the whole entry |
[luck] | open, page next|previous | Opens the luck menu, or turns its page |
SnDungeons menu tags (modules)
| Tag | Arguments | What it does |
|---|---|---|
[zones-menu] | zones, stages <zone> | Opens the zones menu, or the stages of a zone |
[zones-menu] | tp <zone> <stage> | Teleports to a stage you unlocked |
[zones-menu] | buy <zone> <stage>, max, go | Like /zone buy, /zone max and /zone go |
[zones-menu] | visibility | Opens the visibility menu |
[zones-menu] | locked-zone <zone>, locked-stage <zone> <stage> | Tells why a zone or stage is still locked |
[zones-visibility] | solo, island | Picks who you see in the isolated zone worlds |
[sword-menu] | open, upgrade, max | Opens the tiers menu, or buys like /sword upgrade and /sword max |
[sword-enchants] | open [page] | Opens a page of the enchants menu |
[sword-enchants] | upgrade <enchant> | Opens the upgrade menu of an enchant |
[sword-enchants] | buy <enchant> <n|max> | Buys up to n levels, or as many as you can pay |
[sword-enchants] | buy <enchant> <n> exact | Buys exactly n levels, or nothing |
[sword-enchants] | prestige <enchant> | The Prestige button of the upgrade menu |
[sword-enchants] | maxed <enchant>, unbuyable <enchant> | Tells that the enchant is maxed, or cannot be bought now |
[perks] | open, index, roll, rollmax, buy <button>, confirm <perk>, yes, no, animation | The Tool Perks menus: roll, buy tickets, the confirmation and the animation switch |
[auras] | open <auras|index|upgrades>, equip <type>, unequip <type>, upgrade <swing|chance>, index <type> | The auras menus |
[milestones] | open, tab <category>, page next|previous, claim <category> <key>, claim-all [every] | The milestones menu. claim-all every claims in every category |
[totems-menu] | main, upgrades, skins, filter [type|--clear], bulk [tier <n>|value <lo> <hi>] | Opens the totems menus, filters a type, bulk deletes |
[totems-menu] | totem <id>, slot <n>, skin <id>, skin-slot <n>, merge-all, withdraw, upgrade <id> <amount> | Equips, merges, withdraws and upgrades totems |
[totems-menu] | page next|previous, skin-page next|previous, skin-delete, skin-bulk, skin-withdraw | Pages and skin storage |
[attributes] | open, page next|previous | The Sword Attributes menu |
[crystals] | open, page next|previous, crystal <id>, slot <n>, withdraw | Applies, removes and withdraws crystals |
[crystals] | filter [type|--clear], bulk [chance|value <lo> <hi>] | Filters a type, bulk deletes |
[armors] | open <wardrobe|upgrades|skins>, page <wardrobe|skins> <previous|next>, upgrade <id>, skin <id> | The armor menus |
[autofighter] | toggle, target, upgrade <daily|speed|target>, open <autofighter|upgrades> | Spawns or despawns the autofighter, its target mode and upgrades |
[afk] | buy <speed|swings|count> <amount|max>, open afk | The AFK upgrades |
[heroes] | hero <id>, upgrade <id>, enchant <id>, summon-all, store-all, open <heroes|enchants> | Selects, summons and upgrades heroes |
[companions] | upgrade <id> <amount|max>, open upgrades | The companion chance upgrades |
[hunts] | open, claim <slot>, claim-all, reroll <slot>, bonus | The hunts menu |
Viewed. The stages menu and the enchant upgrade menu serve every zone or enchant with one file.
In those menus, write viewed in place of the id: [zones-menu] buy viewed 3,
[sword-enchants] buy viewed 10 exact. It names the zone or enchant the player opened. The booster
storage does the same with start-viewed and end-viewed.
The upgrade buttons of auras, armors and autofighter buy by click type. A left click buys the first
of the module's upgrade-amounts, a right click the second, a shift click the third. Each module page
explains its own verbs in detail.
Tips
- Change looks freely, but keep the
view-requirementsof a state tile: they decide which look shows. - To test a condition, put the placeholder in a lore line and watch what it prints.
- Test a new menu with
[open] <id>from a button of a menu you know works. - After an update, check the console for
moved to old-: a reshaped menu needs your edits again.