Output group/track lists in alphabetical order
This commit is contained in:
parent
e4bfe09882
commit
5dcb8cd73a
@ -32,7 +32,6 @@ import me.lucko.luckperms.common.core.model.Group;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -50,9 +49,10 @@ public class ListGroups extends SingleCommand {
|
||||
|
||||
Message.GROUPS_LIST.send(
|
||||
sender,
|
||||
Util.listToCommaSep(new ArrayList<>(plugin.getGroupManager().getAll().values().stream()
|
||||
Util.toCommaSep(plugin.getGroupManager().getAll().values().stream()
|
||||
.map(Group::getDisplayName)
|
||||
.collect(Collectors.toList()))
|
||||
.sorted()
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
return CommandResult.SUCCESS;
|
||||
|
@ -31,8 +31,8 @@ import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListTracks extends SingleCommand {
|
||||
public ListTracks() {
|
||||
@ -46,7 +46,7 @@ public class ListTracks extends SingleCommand {
|
||||
return CommandResult.LOADING_ERROR;
|
||||
}
|
||||
|
||||
Message.TRACKS_LIST.send(sender, Util.listToCommaSep(new ArrayList<>(plugin.getTrackManager().getAll().keySet())));
|
||||
Message.TRACKS_LIST.send(sender, Util.toCommaSep(plugin.getTrackManager().getAll().keySet().stream().sorted().collect(Collectors.toList())));
|
||||
return CommandResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ import io.github.mkremins.fanciful.ChatColor;
|
||||
import io.github.mkremins.fanciful.FancyMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -414,7 +415,7 @@ public class Util {
|
||||
}
|
||||
}
|
||||
|
||||
public static String listToCommaSep(List<String> strings) {
|
||||
public static String toCommaSep(Collection<String> strings) {
|
||||
if (strings.isEmpty()) return "&bNone";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -97,8 +97,9 @@ public class SpongeMainCommand extends Command<Void, LPSubjectData> {
|
||||
|
||||
if (args.size() < 1) {
|
||||
Util.sendPluginMessage(sender, "&aCurrent Subject Collections:\n" +
|
||||
Util.listToCommaSep(service.getCollections().keySet().stream()
|
||||
Util.toCommaSep(service.getCollections().keySet().stream()
|
||||
.filter(s -> !s.equalsIgnoreCase("user") && !s.equalsIgnoreCase("group"))
|
||||
.sorted()
|
||||
.collect(Collectors.toList())
|
||||
)
|
||||
);
|
||||
@ -127,9 +128,9 @@ public class SpongeMainCommand extends Command<Void, LPSubjectData> {
|
||||
List<String> extra = subjects.subList(50, subjects.size());
|
||||
int overflow = extra.size();
|
||||
extra.clear();
|
||||
Util.sendPluginMessage(sender, "&aCurrent Subjects:\n" + Util.listToCommaSep(subjects) + "&b ... and &a" + overflow + " &bmore.");
|
||||
Util.sendPluginMessage(sender, "&aCurrent Subjects:\n" + Util.toCommaSep(subjects) + "&b ... and &a" + overflow + " &bmore.");
|
||||
} else {
|
||||
Util.sendPluginMessage(sender, "&aCurrent Subjects:\n" + Util.listToCommaSep(subjects));
|
||||
Util.sendPluginMessage(sender, "&aCurrent Subjects:\n" + Util.toCommaSep(subjects));
|
||||
}
|
||||
|
||||
return CommandResult.SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user