Interface CurrencyProvider


public interface CurrencyProvider
Keeps care of the currency's business-logic.
  • Method Details

    • getCurrency

      Currency getCurrency()
      Returns the currency this provider is for.
      Returns:
      The currency that this provider is handling
    • getType

      Returns the type of this provider.
      Returns:
      The type of this provider
    • formatDisplayAmount

      String formatDisplayAmount(BigDecimal amount)
      Formats the given amount into a displayable string.

      This method includes the currency's symbols, delimiters etc.

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

      String formatPlainAmount(BigDecimal amount)
      Formats the given amount into a plain string.

      This method does not include the currency's symbol, but it includes the delimiters.

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

      void getAmount(OfflinePlayer player, Consumer<BigDecimal> callback)
      Gets the amount of the given player.

      The callback might not be called immediately. It is promised that the callback will be synchronized to the server's main-thread.

      Parameters:
      player - The player to get the amount of
      callback - The callback to call when the amount has been fetched
    • setAmount

      void setAmount(OfflinePlayer player, BigDecimal amount, @Nullable @Nullable Runnable callback)
      Sets the amount of the given player.

      The callback might not be called immediately. It is promised that the callback will be synchronized to the server's main-thread.

      Parameters:
      player - The player to set the amount of
      amount - The amount to set
      callback - The callback to call when the amount has been set. null if none is needed
      See Also:
    • setAmount

      default void setAmount(OfflinePlayer player, BigDecimal amount)
      Sets the amount of the given player.

      The change might not occur immediately, as data might have to be loaded first.

      Parameters:
      player - The player to set the amount of
      amount - The amount to set
      See Also:
    • addAmount

      void addAmount(OfflinePlayer player, BigDecimal addAmount, @Nullable @Nullable Consumer<BigDecimal> callback)
      Adds the given amount to the player's current amount.

      The callback might not be called immediately. It is promised that the callback will be synchronized to the server's main-thread.

      Parameters:
      player - The player to add the amount to
      addAmount - The amount to add
      callback - The callback to call when the amount has been added. null if none is needed
      See Also:
    • addAmount

      default void addAmount(OfflinePlayer player, BigDecimal addAmount)
      Adds the given amount to the player's current amount.

      The change might not occur immediately, as data might have to be loaded first.

      Parameters:
      player - The player to add the amount to
      addAmount - The amount to add
      See Also: