Currency API
The EdToolsCurrencyAPI
is used for managing player balances for custom currencies defined in the plugin's configuration.
Get API Instance
EdToolsCurrencyAPI currencyAPI = EdToolsAPI.getInstance().getCurrencyAPI();
Methods
getCurrency(UUID uuid, String currency)
getCurrency(UUID uuid, String currency)
Retrieves the balance of a specific currency for a player.
uuid
: The player's unique ID.currency
: The ID of the currency (e.g., "gems").Returns: A
double
representing the player's balance.
setCurrency(UUID uuid, String currency, double amount)
setCurrency(UUID uuid, String currency, double amount)
Sets a player's currency balance to a specific amount.
uuid
: The player's unique ID.currency
: The currency ID.amount
: The new balance to set.
addCurrency(UUID uuid, String currency, double amount)
addCurrency(UUID uuid, String currency, double amount)
Adds a specified amount to a player's currency balance.
uuid
: The player's unique ID.currency
: The currency ID.amount
: The amount to add.
removeCurrency(UUID uuid, String currency, double amount)
removeCurrency(UUID uuid, String currency, double amount)
Removes a specified amount from a player's currency balance.
uuid
: The player's unique ID.currency
: The currency ID.amount
: The amount to remove.
isCurrency(String currency)
isCurrency(String currency)
Checks if a currency with the given ID is registered in the plugin.
currency
: The currency ID.Returns: A
boolean
indicating if the currency exists.
getMaxCurrencyValue(String currency)
getMaxCurrencyValue(String currency)
Gets the maximum possible value for a given currency.
currency
: The currency ID.Returns: A
double
for the maximum value.
getStartingCurrencyValue(String currency)
getStartingCurrencyValue(String currency)
Gets the default starting value for a given currency.
currency
: The currency ID.Returns: A
double
for the starting value.
getCurrencyName(String currency)
getCurrencyName(String currency)
Gets the display name of a currency.
currency
: The currency ID.Returns: A
String
containing the formatted name.
Was this helpful?