Sort flag list alphabetically

This commit is contained in:
Jesse Boyd 2018-06-13 09:28:32 +10:00
parent 37b0cdeace
commit 6ed6f607b5
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 7 additions and 8 deletions

View File

@ -151,7 +151,7 @@ public class DebugExec extends SubCommand {
@Override @Override
public boolean onCommand(final PlotPlayer player, String[] args) { public boolean onCommand(final PlotPlayer player, String[] args) {
List<String> allowed_params = List<String> allowed_params =
Arrays.asList("calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "seen", "list-scripts"); Arrays.asList("analyze", "calibrate-analysis", "remove-flag", "stop-expire", "start-expire", "seen", "list-scripts", "start-rgar", "stop-rgar", "help", "addcmd", "runasync", "run", "allcmd", "all");
if (args.length > 0) { if (args.length > 0) {
String arg = args[0].toLowerCase(); String arg = args[0].toLowerCase();
String script; String script;

View File

@ -15,11 +15,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.*;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@CommandDeclaration( @CommandDeclaration(
command = "setflag", command = "setflag",
@ -250,8 +246,11 @@ public class FlagCmd extends SubCommand {
} }
String message = ""; String message = "";
String prefix = ""; String prefix = "";
for (Map.Entry<String, ArrayList<String>> stringArrayListEntry : flags.entrySet()) { for (Map.Entry<String, ArrayList<String>> entry : flags.entrySet()) {
message += prefix + "&6" + stringArrayListEntry.getKey() + ": &7" + StringMan.join(stringArrayListEntry.getValue(), ", "); String category = entry.getKey();
List<String> flagNames = entry.getValue();
Collections.sort(flagNames);
message += prefix + "&6" + category + ": &7" + StringMan.join(flagNames, ", ");
prefix = "\n"; prefix = "\n";
} }
MainUtil.sendMessage(player, message); MainUtil.sendMessage(player, message);