Advertisement
PerryPlaysMC

Untitled

Jul 18th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1.     public ArrayList<String> getBaltop(){
  2.         //DecimalFormat df = new DecimalFormat("###,###.##");
  3.         Map<String, Object> map = money.getConfig().getConfigurationSection("Balances").getValues(true);
  4.         ArrayList<String> lines = new ArrayList<String>();
  5.         for(Entry<String, Object> e : map.entrySet()) {
  6.             lines.add(e.getValue() + " " + e.getKey());
  7.         }
  8.         return lines;
  9.     }
  10.  
  11.         if(cl.equalsIgnoreCase("baltop")) {
  12.             s.sendMessage(prefix + "Balance tops are");
  13.             ArrayList<String> data = getBaltop();
  14.             Collections.sort(data, new Comparator<String>() {
  15.                 @Override
  16.                 public int compare(String a, String b) {
  17.                     double aVal = Double.parseDouble(a.split(" ")[0]);
  18.                     double bVal = Double.parseDouble(b.split(" ")[0]);
  19.                     return Double.compare(aVal, bVal);
  20.                 }
  21.             });
  22.             for(int i = (data.size() > 10 ? 10 : data.size()) - 1; i >= 0; i--) {
  23.                 String line = data.get(i);
  24.                 String[] splitter = line.split(" ");
  25.                 String pname = splitter[1]; String bal = splitter[0];
  26.                
  27.                 s.sendMessage("§c§l" + pname + "§6§l: §a§l$§e§l" + bal);
  28.             }
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement