Class MoneyUtils

java.lang.Object
com.booksaw.betterTeams.util.MoneyUtils

public class MoneyUtils extends Object
Utility methods revolving around formatting money
  • Constructor Details

    • MoneyUtils

      public MoneyUtils()
  • Method Details

    • useShortFormatting

      public static boolean useShortFormatting()
      Returns:
      If short money is enabled in the config
    • getDecimalPlaceFormattingString

      public static String getDecimalPlaceFormattingString()
      Returns:
      The double formatted string, with the number of decimal places defined in the config
    • getFormattedDouble

      public static String getFormattedDouble(double amount)
      Get a formatted double using the default formatting in the config
      Parameters:
      amount - The value of the money to format
      Returns:
      the formatted String
    • getFormattedDouble

      public static String getFormattedDouble(double amount, String doubleFormat, boolean shortFormatting)
      Get a formatted string from a monetary amount
      Parameters:
      amount - the amount of money
      doubleFormat - the double format i.e. 0.00, used if shortFormatting is false
      shortFormatting - if true will truncate the value, such as 12.0k
      Returns:
      a formatted string of the amount
    • getFormattedShortDouble

      public static String getFormattedShortDouble(double amount)
      Get the short formatted version of the amount, i.e. 10.0K
      Parameters:
      amount - The amount to formatted
      Returns:
      The created formatted string