Sort server providers

This commit is contained in:
Matt
2014-04-20 19:42:02 -04:00
parent 4e6f2399c8
commit 33aece0301
2 changed files with 9 additions and 2 deletions
@@ -7,7 +7,7 @@ package org.parabot.core.desc;
* @author Everel
*
*/
public class ServerDescription {
public class ServerDescription implements Comparable<ServerDescription> {
private String serverName;
private String author;
private double revision;
@@ -37,4 +37,9 @@ public class ServerDescription {
this.serverName, this.author, this.revision);
}
@Override
public int compareTo( ServerDescription o ) {
return this.getServerName().compareTo( o.getServerName() );
}
}
@@ -7,6 +7,7 @@ import org.parabot.environment.servers.ServerExecuter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
/**
* Abstract class for parsing server providers
@@ -42,8 +43,9 @@ public abstract class ServerParser {
Core.verbose("Server providers parsed.");
}
Map<ServerDescription, ServerExecuter> SORTED_SERVER_CACHE = new TreeMap<ServerDescription, ServerExecuter>( SERVER_CACHE );
return SERVER_CACHE.keySet().toArray(new ServerDescription[SERVER_CACHE.size()]);
return SORTED_SERVER_CACHE.keySet().toArray(new ServerDescription[SORTED_SERVER_CACHE.size()]);
}
}