Number formatting in /mspt and /tps uses the system locale

Open Beginner friendly
#14,496 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
77/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java
Domain
backend

Research direction

Start by locating PaperMSPTCommand, Spigot's TicksPerSecondCommand, Moonrise's EntityUtil, and the existing RAMDetails locale handling mentioned in the issue. Check how each DecimalFormat is created and compare its output under a German locale with Locale.ROOT formatting. Done means all three outputs use locale independent decimal separators; run the relevant command or entity dump tests if available.

Written by the indexing model from the issue text.

Description

PaperMSPTCommand (new DecimalFormat("########0.0")) and Spigot's TicksPerSecondCommand (new DecimalFormat("########0.0")) don't specify a locale, so the output depends on the JVM's default locale. On a German locale, for example, 19.5 prints as 19,5.

Mojang always formats numbers with Locale.ROOT, and Paper's own RAMDetails already uses DecimalFormatSymbols.getInstance(Locale.ROOT). The server's locale is unrelated to the locale of the players reading the output.

Moonrise's EntityUtil (new DecimalFormat("#,##0.000"), used in entity dumps in logs) has the same issue. Reported upstream at Tuinity/Moonrise#228.

Dominant language
Java
Stars
12.8k
Forks
3.6k
Avg merge
3d 7h
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PaperMC/Paper

All issues in PaperMC/Paper

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.