package net.new_liberty.pvpranker.command;

import java.util.LinkedHashMap;
import java.util.Map.Entry;
import net.new_liberty.pvpranker.PvPRanker;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

/**
 * Displays the top PvPers on the server.
 */
public class PvPTopCommand implements CommandExecutor {
    private final PvPRanker plugin;

    public PvPTopCommand(PvPRanker plugin) {
        this.plugin = plugin;
    }

    @Override
    public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
        String milestone = null;
        if (args.length > 0) {
            milestone = args[0];
        }

        final String theMilestone = milestone;

        plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
            @Override
            public void run() {
                final LinkedHashMap<String, Integer> map = plugin.generateScoreReport(10, theMilestone);
                sender.sendMessage(ChatColor.YELLOW + "== PvP Top Scores ==");
                if (map.isEmpty()) {
                    sender.sendMessage(ChatColor.GREEN + "Nobody " + (theMilestone == null ? "has killed anyone yet" : "killed anyone during " + theMilestone) + ".");

                } else {
                    int i = 1;
                    for (Entry<String, Integer> playerScore : map.entrySet()) {
                        sender.sendMessage(ChatColor.GREEN + Integer.toString(i++) + ") " + playerScore.getKey() + " - " + playerScore.getValue());
                    }
                }
            }
        });

        return true;
    }
}

@@ -141,16 +141,55 @@
 Ranker;%0A
+import net.new_liberty.pvpranker.Rank;%0A
 import o
@@ -700,20 +700,37 @@
 stone = 
-null
+plugin.getMilestone()
 ;%0A      
@@ -1296,16 +1296,38 @@
 tone
- == null
+.equals(plugin.getMilestone())
  ? %22
@@ -1532,24 +1532,154 @@
 trySet()) %7B%0A
+                        int score = playerScore.getValue().intValue();%0A                        Rank rank = plugin.getRank(score);%0A
             
@@ -1786,34 +1786,39 @@
  + %22
- -
+:
  %22 + 
-playerScore.getValu
+score + %22 %22 + rank.getNam
 e())

Make /pvptop display the current milestone by default