use of com.palmergames.bukkit.towny.object.TownyEconomyObject in project Towny by ElgarL.
the class TownyCommand method getTopBankBalance.
public List<String> getTopBankBalance(List<TownyEconomyObject> list, int maxListing) throws EconomyException {
List<String> output = new ArrayList<String>();
KeyValueTable<TownyEconomyObject, Double> kvTable = new KeyValueTable<TownyEconomyObject, Double>();
for (TownyEconomyObject obj : list) {
kvTable.put(obj, obj.getHoldingBalance());
}
kvTable.sortByValue();
kvTable.revese();
int n = 0;
for (KeyValue<TownyEconomyObject, Double> kv : kvTable.getKeyValues()) {
n++;
if (maxListing != -1 && n > maxListing)
break;
TownyEconomyObject town = (TownyEconomyObject) kv.key;
output.add(String.format(Colors.LightGray + "%-20s " + Colors.Gold + "|" + Colors.Blue + " %s", TownyFormatter.getFormattedName(town), TownyEconomyHandler.getFormattedBalance((Double) kv.value)));
}
return output;
}
Aggregations