Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abbreviating large numbers. #31

Open
ElitoGame opened this issue Sep 1, 2022 · 0 comments
Open

Abbreviating large numbers. #31

ElitoGame opened this issue Sep 1, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ElitoGame
Copy link
Collaborator

Short Description

Add an option to abbreviate larger numbers with letters like k for thousand, m for million, b for billion, etc.

Implementation

  • Add a a config.yml setting to enable/disable this feature for input and the for outputs individually. See the following list for default values:
    • any Input: true
    • Hologram Output: false
    • Shop Buy/Sell GUI Output: false
    • Checkprofits: false
  • Alternatively for output, the LanguageManager could be updated. Any Number type output that ends with _abbreviated or something similar will be displayed abbreviated. A config for input should still be required.
  • Input like 1,5k or 1.03K should be handled too.

Additional Notes:

This quick snippet might help you get going ;)

    public static String coolNumberFormat(long count) {
        if (count < 1000) return "" + count;
        int exp = (int) (Math.log(count) / Math.log(1000));
        DecimalFormat format = new DecimalFormat("0.#");
        String value = format.format(count / Math.pow(1000, exp));
        return String.format("%s%c", value, "kMBTPE".charAt(exp - 1));
    }
@ElitoGame ElitoGame added enhancement New feature or request good first issue Good for newcomers labels Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant