Skip to main content

Number Formats

1500000.5 is what a placeholder gives, but nobody wants to read that on a hologram. A number format decides how values are written: in the menu, in chat, on holograms, signs and NPCs, in reward commands (%value%) and in the _formatted placeholders. The value itself, and the ranking, never change.

The three formats​

Format1500000.5 is written asGood for
Number1,500,000.5Kills, levels, blocks, votes: anything counted
Compact1.5MMoney and other big numbers, short enough for a tab list
Time17d 8h 40m (if counted in seconds)Play time, lap times, anything that is a time

Number keeps up to two decimals and leaves them out when there are none: 42, 3.5, 1,234.57.

Compact writes thousands as K, millions as M, then B, T and Q, with one decimal: 950, 1.5K, 12.3M. Below a thousand it is written like Number.

Time writes the biggest part and the two after it, leaving out zero parts: 2d 3h 15m, 5h 20s, 45s. So seconds only show for times under a day.

The time unit​

A placeholder that gives a time gives it as a plain number, and the plugin has to know what that number counts. That is the time unit: ticks, seconds, minutes or hours.

The placeholder countsUnit72000 is written as
Ticks (Minecraft statistics such as play time)ticks1h
Secondsseconds20h
Minutesminutes50d

If play times look absurd (52y or 3s), the unit is wrong. The Number Format screen shows an example with your leaderboard's real #1 value, so you can tell at a glance.

Setting a leaderboard's format​

/lb admin → Leaderboards → a leaderboard → Number Format:

  1. Click Number, Compact or Time. Each one shows your #1 value written that way.
  2. For a time, click Time Unit until it matches what the placeholder counts in.
  3. Use the Default removes the leaderboard's own format again.

It is saved under number-format.leaderboards in config.yml:

number-format:
default: number # leaderboards without a format of their own
unit: seconds
leaderboards:
vault_eco_balance:
type: compact
statistic_play_one_minute:
type: time
unit: ticks

The default for every other leaderboard is under /lb admin → Configuration → Default Number Format (left click for the next format, right click for the next time unit).

A placeholder with a dot in its name cannot have a format of its own (a dot cannot be part of a key in config.yml); it uses the default.

A different format in one place​

Sometimes one place needs another format: the scoreboard has room for 1.5M but the menu should show the full 1,500,000. Add the format to the placeholder:

%nexalleaderboards_vault_eco_balance_1_formatted%   → the leaderboard's own format
%nexalleaderboards_vault_eco_balance_1_number% → 1,500,000.5
%nexalleaderboards_vault_eco_balance_1_compact% → 1.5M
%nexalleaderboards_statistic_play_one_minute_1_time_ticks% → 2d 3h 15m
%nexalleaderboards_vault_eco_balance_1_value% → 1500000.5 (raw, for maths)

_ticks, _seconds, _minutes and _hours set the unit of _time for that one placeholder.

Other languages​

The letters are in the number-format section of messages.yml:

number-format:
compact: ["K", "M", "B", "T", "Q"]
days: "d"
hours: "h"
minutes: "m"
seconds: "s"

For example compact: ["k", "Mio", "Mrd"] for German, or days: "μ" and so on. Everything that shows values changes at once.