Skip to main content

Placeholders

The PlaceholderAPI placeholders of Nexal Leaderboards.

Requires PlaceholderAPI. A placeholder is built as %nexalleaderboards_<placeholder>[_<period>]_<target>[_<modifier>...]%:

  • <placeholder>: the tracked placeholder without % signs
  • <period> (optional): a period from config.yml, such as weekly or 30d, for that period's ranking
  • <target>: a rank starting at 1, rank (the viewing player's rank) or score (the viewing player's value)
  • <modifier>: any number, in any order, at most one of each kind
ModifierGives
namePlayer name (the default for a rank)
valueRaw value, 1500000.5 (the default for score)
formattedThe value in the leaderboard's number format
number, compact, timeThe value as 1,500,000.5, 1.5M or 2d 3h 15m, whatever the leaderboard's format
ticks, seconds, minutes, hoursThe unit a time is counted in, instead of the leaderboard's
reversedCount from the other end: rank 1 is the lowest value (the highest on a lowest-first leaderboard)
changeHow the rank moved since rank-change.hours ago: ▲3, ▼1, NEW (coloured, from messages.yml)

rank takes only reversed and change; score takes everything but name and change. An empty rank returns - for the name and 0 for the values; an unranked viewer gets - for the rank and 0 for the value.

%nexalleaderboards_<placeholder>_name%, with no target, gives the leaderboard's display name (display-names in config.yml), coloured, or the placeholder itself when it has none. When the part before _name is a tracked placeholder, it is always read this way (as with periods, a tracked placeholder stays itself).

%nexalleaderboards_vault_eco_balance_1%            → Steve
%nexalleaderboards_vault_eco_balance_1_formatted% → 1,500,000.5
%nexalleaderboards_statistic_player_kills_3_value% → 150.0
%nexalleaderboards_statistic_player_kills_weekly_1% → Alex (most kills this week)
%nexalleaderboards_vault_eco_balance_30d_rank% → 12 (the viewer, by money earned in 30 days)
%nexalleaderboards_vault_eco_balance_1_compact% → 1.5M
%nexalleaderboards_statistic_time_played_score_time_ticks% → 2d 3h 15m (the viewer's play time)
%nexalleaderboards_parkour_time_1_name_reversed% → Steve (the lowest value)
%nexalleaderboards_vault_eco_balance_1_change% → ▲2 (the #1 moved up two ranks in a day)
%nexalleaderboards_vault_eco_balance_rank_change% → NEW (the viewer was not ranked a day ago)
%nexalleaderboards_vault_eco_balance_name% → Richest (the leaderboard's display name)

Scoreboard example:

lines:
- "&6Top Balances:"
- "#1 %nexalleaderboards_vault_eco_balance_1% - $%nexalleaderboards_vault_eco_balance_1_formatted%"
- "#2 %nexalleaderboards_vault_eco_balance_2% - $%nexalleaderboards_vault_eco_balance_2_formatted%"
- "#3 %nexalleaderboards_vault_eco_balance_3% - $%nexalleaderboards_vault_eco_balance_3_formatted%"

How tracking works​

  1. A placeholder starts being tracked with /lb admin track, or automatically the first time a %nexalleaderboards_...% placeholder asks for it (auto-track-on-query: true). Either way it must give a number for at least one online player; an unknown or text placeholder is refused (auto-tracking tries such a placeholder again after a minute at most).
  2. On every refresh the placeholder is read for each online player and the scores are stored.
  3. Offline players keep their last score.
  4. A value counts as its first number. Colour codes, thousands separators and spaces are removed first, so a gold 1,500 is 1500 and Level 5 is 5; a value without digits reads as 0.

How periods work​

A period's score is a player's value now minus their value when the period started: the kills made this week, the money earned in the last 30 days. Players whose value did not change in the period are not ranked on it. A value that went down gives a negative score.

The values in between come from the score history: on every refresh the plugin keeps the last value of each hour, for history.hourly-days days, and the last value of each day after that, up to history.retention-days. Periods are worked out from it whenever they are asked for, so changing or adding a period applies to the past too, as far back as the history goes. History starts when a placeholder is first tracked (or, for the scores of an older version, with their last stored value), and a player first seen during a period counts from the value they had then.

  • calendar periods start again at midnight (in timezone) on each new day, week, month or year; rolling periods are the last so many hours or days and move on every hour
  • Periods can be added, changed and removed in-game under /lb admin → Periods: the name of a new period is typed in chat, then its kind, unit, week start or length and display name are set in its screen. The Time Zone button there sets timezone. Every change is saved to config.yml and applies right away. Removing a period keeps the history, so adding it back brings its rankings back
  • A rolling period older than the hourly history is accurate to the day

Rank change arrows​

Every rank can show how it moved: ▲3 (up three), ▼1 (down one), nothing for the same rank, NEW for a player who was not ranked then. It compares the rank with the rank rank-change.hours ago (24 by default, also in the settings GUI), from the score history. On a period board it compares with the same board as it stood then. The arrows are in the rank-change section of messages.yml and show as %change% in the GUI entry names, the hologram lines and, if you add it, leaderboard-top-entry; in placeholders as _<pos>_change and _rank_change.

Period rewards​

When a calendar period ends (a new day, week, month or year in timezone), the plugin runs the commands of the rewards section for the players ranked on it, from the console:

rewards:
vault_eco_balance: # the leaderboard
weekly: # a calendar period
"1":
- "eco give %player% 10000"
- "broadcast %player% earned the most this week: %value%"
"2-3":
- "eco give %player% 5000"
  • The ranking is the final one of the period that ended, worked out from the score history, so it is the same whenever the check runs; it follows the leaderboard's order and leaves out excluded players. Ranges may overlap: every tier that covers a rank runs.
  • A score of nothing earns nothing: on a highest-first leaderboard a player needs a score above 0 for the period, and on any leaderboard a score that is written as 0 (under a second of play time shows as 0s) is skipped. Skipped players get no commands, no message and are not announced; the ranks of the others stay as they are.
  • In a command: %player%, %uuid%, %rank%, %value% (the period's score in the leaderboard's number format), %period% (its name), %placeholder% (the placeholder itself) and %name% (the leaderboard's display name, as written in display-names).
  • A player who is offline gets the reward the next time they join, with a message.
  • Every payout is stored: a restart never pays a period twice, and a period that ended while the server was down is paid when it starts again (only the last one, if several ended). A reward set up during a period is first paid at the end of that period.
  • Rolling periods (7d, 30d) never end, so they have no rewards.
  • With rewards-broadcast: true (the default; also in the settings GUI) the rewarded players are announced in chat: reward-broadcast-header and reward-broadcast-entry in messages.yml, which uses %winner% for the name.
  • In-game: /lb admin → Leaderboards → the leaderboard → Rewards → a period. Add ranks and their commands by typing them in chat (commands without the /); right click removes a tier's last command, shift right click the whole tier. Saved to config.yml.