Stats and Tops
On this page(15)
SnDungeons counts what each player does at the zone mobs: swings, damage, kills and what they earned. Every currency, every leveling track and the main stats have a top, and /tops shows them all in one menu. Tops give players a reason to compete, and the milestones read the same counters.
| Files | stats.yml, the tops: and menus.tops blocks of config.yml, the menu guis/tops.yml |
| Player commands | /swings, /dmg, /tops, /<currency> top, /<track> top |
| Admin commands | none |
| Switch | Always on (core). Each command can be removed with command: '' |
How it works
The counters
Every counter is saved with the player's data.
| Counter | What it counts |
|---|---|
| Swings | Every swing at a zone mob. |
| Damage | All the damage dealt to the zone mobs: swings, enchants and helpers. |
| Kills | The zone mobs the player killed. |
| Earned, per currency | What each currency earned by playing: zone mob kills and enchants, with boosters. Never a give, a payment, a pouch or an admin change. |
| Peak, per track | The highest level reached of each leveling track. A rebirth never lowers it. It starts at the level the player has. |
| Perks rolled | The sword perk rolls of the perks module. The rolls stay stored while the module is off. |
| Milestones | The milestones completed in every category that is not of source milestones (milestones module). |
Why earned and peak exist. A balance goes down when a player spends, and a level goes down at a rebirth. Earned and peak only grow, so they measure progress fairly.
The tops
A top ranks the players of one board:
| Board | Ranks |
|---|---|
currency_<id> | The balance of a currency (/money top). |
level_<track> | The level of a track (/level top, /rebirth top). |
swings | The swings (/swings top). |
damage | The damage dealt (/dmg top). |
perks-rolled | The perk rolls (the /tops menu). |
milestones | The milestones completed (the /tops menu). |
The tops are read from the database every tops.refresh-seconds. Online players always count with their current values. Each top keeps tops.size players.
A top [page] command shows 10 players per page, then where you stand.
Configuration
stats.yml
stats.yml names the two stat commands. It is managed: new keys are merged on boot while update-configs is true. /dungeons reload re-reads it.
| Key | Default | What it does |
|---|---|---|
commands.swings.command | swings | The swings command. '' means none. |
commands.swings.aliases | [] | Other names. |
commands.swings.permission | '' | '' means everyone. |
commands.swings.display-name | '&bSwings' | The name of what is ranked: the top's header and the tops menu. |
commands.damage.command | dmg | The damage command. '' means none. |
commands.damage.aliases | [] | Other names. |
commands.damage.permission | '' | '' means everyone. |
commands.damage.display-name | '&cDamage' | The name of what is ranked. |
The damage command ships as /dmg because vanilla Minecraft has its own /damage. SnDungeons never takes a server, vanilla or Brigadier command. A name another plugin owns is taken, and that plugin keeps answering as /<plugin>:<name>.
tops (config.yml)
| Key | Default | What it does |
|---|---|---|
tops.refresh-seconds | 60 | Seconds between reads of the tops from the database (10 to 3600). |
tops.size | 10 | Players in each top (1 to 100). |
Example. With size: 25, /money top 3 shows places 21 to 25. The /tops menu shows the first 10, because its lore lists 10 lines.
menus.tops (config.yml)
| Key | Default | What it does |
|---|---|---|
menus.tops.command | tops | The /tops command. '' means no command (the menu still opens with [open] tops). |
menus.tops.aliases | [] | Other names. |
menus.tops.permission | '' | '' means everyone. |
See General Config for the rest of the menus: block.
Turning a top off
A currency or leveling file turns its top off under commands::
currencies/rebirth-points.yml
commands:
top:
enable: false
permission: ''A file without the top block has it on, for everyone. Give it a permission to make it a rank perk.
The /tops menu
/tops opens guis/tops.yml:
#########
#M#S#E#L#
#R#W#D#P#
####N####
########X| Cell | Board |
|---|---|
M, S, E | Money, souls, experience. |
L, R | Level, rebirth. |
W, D | Swings, damage dealt. |
P | Sword perk rolls (perks module). |
N | Milestones completed (milestones module). |
X | Close. |
Each tile lists the top 10 with %sndungeons_top_<board>_<n>_name% and _<n>_value, then your own value and position. A currency or track you add needs its own tile. Copy one, change the board in its placeholders, and give it a free layout letter.
One lore line of a tile
- " &6#1 &f%sndungeons_top_currency_money_1_name% &8- &e%sndungeons_top_currency_money_1_value%"See Menus and Action Tags for how menu files work.
Messages
The texts are in lang/messages_en.yml:
| Key | What it is |
|---|---|
messages.stats.swings, damage | The answer of /swings and /dmg alone ({value}). |
messages.stats.busy | Sent while the player's stats still load. |
messages.tops.header | The first line of a top ({board}, {page}, {pages}). |
messages.tops.line | One line per player ({position}, {player}, {value}). |
messages.tops.you, you-unranked | Where you stand, inside or outside the top. |
messages.tops.empty | Sent while nobody is in the top. |
Commands
| Command | Permission | Description |
|---|---|---|
/swings | none | Your swings at zone mobs. |
/swings top [page] | none | The players with the most swings, 10 per page, and where you stand. |
/dmg | none | Your damage dealt, rounded to a whole number. |
/dmg top [page] | none | The players with the most damage, 10 per page, and where you stand. |
/tops | none | Opens the tops menu. |
/<currency> top [page] | none | The players with the highest balance (/money top). |
/<track> top [page] | none | The players with the highest level (/level top, /rebirth top). |
Full list: Commands.
Placeholders
<board> is currency_<id>, level_<track>, swings, damage, perks-rolled or milestones. Full list: Placeholders.
| Placeholder | Description |
|---|---|
%sndungeons_stat_swings% and _raw | Your swings |
%sndungeons_stat_damage% and _raw | Your damage dealt |
%sndungeons_stat_perks-rolled% and _raw | Your sword perk rolls |
%sndungeons_stat_kills% and _raw | Your zone mob kills |
%sndungeons_stat_earned_<currency>% and _raw | What you earned of a currency by playing |
%sndungeons_stat_peak_<track>% and _raw | Your highest level reached in a track |
%sndungeons_stat_milestones% and _raw | Your milestones top value |
%sndungeons_top_<board>_<n>_name%, _<n>_value | The player at position n and their value (empty past the end) |
%sndungeons_top_<board>_position% | Your position in that top (empty outside it) |
The _raw variants return a plain number.
Tips
- Use the top placeholders on a hologram or a scoreboard for a live leaderboard.
- A short
refresh-secondsreads the database more often. 60 seconds is plenty for most servers. /rebirthpoints topships off. Setcommands.top.enable: truein its file to rank the points too.- The kills, earned and peak counters have no top, but milestones can reward them.
Default stats.yml
# ============================================================
# SnDungeons - stats.yml
# The stat counters: the swings done and the damage dealt to the zone mobs
# (every source: swings, enchants, helpers). Re-read on /dungeons reload.
# Managed by SnLib: new keys are merged on boot while update-configs is
# true in config.yml; your values and comments are kept.
# ============================================================
# The commands of the stats. Alone they show your own value; "top [page]"
# shows the players with the most (config.yml tops:). A command of '' means
# no command. A permission of '' means no permission is needed. When another
# plugin's command already has a name or an alias, SnDungeons takes it
# (command priority); a server, vanilla or Brigadier command is never taken
# (vanilla has its own /damage, so the damage command ships as /dmg).
commands:
# /swings and /swings top [page].
swings:
# Command name ('' = none).
command: swings
# Other names of the command.
aliases: []
# Permission needed to use the command at all.
permission: ''
# The name of what is ranked (the top's header and the tops menu).
display-name: '&bSwings'
# /dmg and /dmg top [page].
damage:
command: dmg
aliases: []
permission: ''
display-name: '&cDamage'Default tops: block of config.yml
# ------------------------------------------------------------
# Tops: /<currency> top, /<track> top, /swings top, /dmg top and the
# %sndungeons_top_...% placeholders. Re-read on /dungeons reload.
# ------------------------------------------------------------
tops:
# Seconds between reads of the tops from the database (10 to 3600). Online
# players always count with their current values.
refresh-seconds: 60
# Players in each top (1 to 100).
size: 10