Interface Currency

  • All Superinterfaces:
    DefaultedRegistryValue

    public interface Currency
    extends DefaultedRegistryValue
    Represents a form of currency. At least one type of currency is always supported.

    Unlike other registry-like values, Currency has no predefined values. Unless a plugin has specific knowledge of a particular currency provided by an economy plugin, EconomyService.defaultCurrency() should usually be used.

    Depending on the provider of the EconomyService, more currencies may be available.

    • Method Detail

      • displayName

        Component displayName()
        The currency's display name, in singular form. Ex: Dollar.
        Returns:
        displayName of the currency singular
      • pluralDisplayName

        Component pluralDisplayName()
        The currency's display name in plural form. Ex: Dollars.

        Not all currencies will have a plural name that differs from the display name.

        Returns:
        displayName of the currency plural
      • symbol

        Component symbol()
        The currency's symbol. Ex. $
        Returns:
        symbol of the currency
      • format

        default Component format​(BigDecimal amount)
        Formats the given amount using the default number of fractional digits.

        Should include the symbol if it is present

        Parameters:
        amount - The amount to format
        Returns:
        String formatted amount
      • format

        Component format​(BigDecimal amount,
                         int numFractionDigits)
        Formats the given amount using the specified number of fractional digits.

        Should include the symbol if it is present

        Parameters:
        amount - The amount to format
        numFractionDigits - The numer of fractional digits to use
        Returns:
        String formatted amount.
      • defaultFractionDigits

        int defaultFractionDigits()
        This is the default number of fractional digits that is utilized for formatting purposes.
        Returns:
        defaultFractionDigits utilized.
      • isDefault

        boolean isDefault()
        Returns true if this currency is the default currency for the economy, otherwise false.
        Returns:
        true if this is the default currency