Vault is a plugin for Bukkit that is also an Economy API. It can be used to post updates to Players' money, and used as a Currency in a server.
VaultAPI is also open-sourced at Github
I'm trying to get the accounts which have the biggest amount of money, but that's not straight-forward in Vault's API.
So, what I tried to do was:
- Iterating through all OfflinePlayers and comparing money values
- Recovering the biggest value
Code:
double highest = 0;
OfflinePlayer topPlayer;
OfflinePlayer[] players = Bukkit.getOfflinePlayers();
for (OfflinePlayer p : players) {
double playerAmount = econ.getBalance(p); //Econ is Economy instance from Vault.
if (playerAmount > highest){
highest = playerAmount;
topPlayer = p;
}
}
I tried iterating all acounts to find the highest amount, but it lags a lot when you have too many Players.
Is there any way to find which players have the biggest amount of money?