RoyaleEconomy
  • RoyaleEconomy Documentation [NOT UP TO DATE]
  • Hooks
  • PlaceholderAPI Support
  • Commands
    • royaleeconomy
    • talismans
    • killcoins
    • interest
    • coinsbag
    • reshop
    • balancetop
    • piggybank
    • bank
    • sharedbank
  • Menus
  • InputGUIs
  • Shops
  • Purse On Death
  • Sounds
  • Permissions
  • Coins Bags
  • Bank Upgrades
  • Interest
  • Kill Coins
  • Talismans
    • Random Coins Talisman
    • Percent Reducer Talisman
    • Death Saver Talisman
  • API
    • Events
    • Balance
    • BalanceTop
    • Bank
    • SharedBank
    • Interest
    • Kill Coins
    • Shops
    • Others
Powered by GitBook
On this page

Was this helpful?

  1. API

Balance

Balance Functions

These functions are found in RoyaleEconomy.apiHandler.balance:

double getBalance(String player) - Gets the purse balance of a player. String player could be either their username or their UUID parsed as string. If you can choose between username and UUID, go with the UUID.

getBalance() example
Player p = e.getPlayer();
double playerBalance = RoyaleEconomy.apiHandler.balance.getBalance(p.getUniqueId().toString());
//or
double playerBalanceAlternative = RoyaleEconomy.apiHandler.balance.getBalance(p.getName());

double getBankBalance(String playerUUID) - Gets the purse balance of a player. String playerUUID is the UUID of the player parsed as string.

getBankBalance() example
Player p = e.getPlayer();
double playerBalance = RoyaleEconomy.apiHandler.balance.getBalance(p.getUniqueId().toString());

double getSharedBankBalance(String bankID) - Gets the purse balance of a player. String bankID could be get from player's uuid via getSharedBankID(String playerUUID).

getSharedBankBalance() example
Player p = e.getPlayer();
String bankID = RoyaleEconomy.apiHandler.sharedBank.getSharedBankID(p.getUniqueId().toString);
double sharedBankBalance = RoyaleEconomy.apiHandler.balance.getSharedBankBalance(bankID);

Similar to the functions above, we have the void functions - addBalance(String player, double toAdd) - removeBalance(String player, double toRemove) - setBalance(String player, double toSet) - addBankBalance(String playerUUID, double toAdd) - removeBankBalance(String playerUUID, double toRemove) - setBankBalance(String playerUUID, double toSet) - addSharedBankBalance(String bankID, double toAdd) - removeSharedBankBalance(String bankID, double toRemove) - setSharedBankBalance(String bankID, double toSet)

Using the functions above you can modify balances but make sure you check the amount you add/remove/set because the plugin won't check for negative values and there must be no negative values.

PreviousEventsNextBalanceTop

Last updated 4 years ago

Was this helpful?