Interface CurrencyProvider
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
addAmount
(OfflinePlayer player, BigDecimal addAmount) Adds the given amount to the player's current amount.void
addAmount
(OfflinePlayer player, BigDecimal addAmount, @Nullable Consumer<BigDecimal> callback) Adds the given amount to the player's current amount.formatDisplayAmount
(BigDecimal amount) Formats the given amount into a displayable string.formatPlainAmount
(BigDecimal amount) Formats the given amount into a plain string.void
getAmount
(OfflinePlayer player, Consumer<BigDecimal> callback) Gets the amount of the given player.Returns the currency this provider is for.getType()
Returns the type of this provider.default void
setAmount
(OfflinePlayer player, BigDecimal amount) Sets the amount of the given player.void
setAmount
(OfflinePlayer player, BigDecimal amount, @Nullable Runnable callback) Sets the amount of the given player.
-
Method Details
-
getCurrency
Currency getCurrency()Returns the currency this provider is for.- Returns:
- The currency that this provider is handling
-
getType
CurrencyProviderType getType()Returns the type of this provider.- Returns:
- The type of this provider
-
formatDisplayAmount
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
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
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 ofcallback
- The callback to call when the amount has been fetched
-
setAmount
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 ofamount
- The amount to setcallback
- The callback to call when the amount has been set.null
if none is needed- See Also:
-
setAmount
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 ofamount
- 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 toaddAmount
- The amount to addcallback
- The callback to call when the amount has been added.null
if none is needed- See Also:
-
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 toaddAmount
- The amount to add- See Also:
-