Sorted out the portal and location sorting

This commit is contained in:
Alastair 2016-08-04 02:37:19 +00:00
parent d4da241c2c
commit 5312eab16b
2 changed files with 17 additions and 20 deletions

View File

@ -404,8 +404,13 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
break;
case "list" :
String message = PluginMessages.customPrefix + " \u00A77Portals \u00A7c:\u00A7a";
LinkedList<String> portals = new LinkedList<>();
for (AdvancedPortal portal : Portal.Portals) {
message = message + " " + portal.portalName;
portals.add(portal.portalName);
}
Collections.sort(portals);
for (Object portalName : portals.toArray()) {
message = message + " " + portalName;
}
player.sendMessage(message);
break;

View File

@ -64,21 +64,13 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
break;
case "list":
String message = PluginMessages.customPrefix + " \u00A77Destinations \u00A7c:\u00A7a";
int locationsPerPage = 5;
if(locationsPerPage > 5){
List<Object> destiObj = Arrays.asList(config.getConfig().getKeys(false).toArray());
List<String> destis = new ArrayList<>();
for (Object object : destiObj) {
destis.add(object != null ? object.toString() : null);
LinkedList<String> destis = new LinkedList<>();
for (Object object : destiObj.toArray()) {
destis.add(object.toString());
}
Collections.sort(destis);
for (String desti : destis) message = message + " " + desti;
sender.sendMessage(message);
}
else{
}
for (String desti : config.getConfig().getKeys(false)) message = message + " " + desti;
for (Object desti : destis.toArray()) message = message + " " + desti;
sender.sendMessage(message);
break;
case "help":
@ -111,7 +103,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
LinkedList<String> autoComplete = new LinkedList<String>();
LinkedList<String> autoComplete = new LinkedList<>();
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
if(args.length > 1 && args[0].equalsIgnoreCase("warp")){
for (String string : config.getConfig().getKeys(false)) {