X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fxdcc%2Fui%2Fstdin%2FCommandReader.java;h=d3821aa44b16e0d2f8fd11136b2eaae3327502ff;hb=627395d1991e2a172ec851247ceb9ef643cb721b;hp=abef80e5c57b502a28c785927e6439a5349218fc;hpb=55c7c1e4b98b06091b5053af4a9157e4a3428b32;p=xudocci.git diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index abef80e..d3821aa 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -351,7 +351,7 @@ public class CommandReader extends AbstractExecutionThreadService { * one name pattern is preferred (and thus listed first), one pattern is * disliked (and thus listed last), the rest is sorted alphabetically. */ - private static final Comparator botNameComparator = new Comparator() { + private static final Comparator botNameComparator = new Comparator() { /** Regular expression pattern for preferred names. */ private final Pattern preferredNames = Pattern.compile("(?i)[^\\w]EUR?[^\\w]"); @@ -360,7 +360,9 @@ public class CommandReader extends AbstractExecutionThreadService { private final Pattern dislikedNames = Pattern.compile("(?i)[^\\w]USA?[^\\w]"); @Override - public int compare(String leftBotName, String rightBotName) { + public int compare(Result leftResult, Result rightResult) { + String leftBotName = leftResult.bot().name(); + String rightBotName = rightResult.bot().name(); /* preferred names to the front! */ if (preferredNames.matcher(leftBotName).find() && !preferredNames.matcher(rightBotName).find()) { return -1; @@ -375,8 +377,7 @@ public class CommandReader extends AbstractExecutionThreadService { if (dislikedNames.matcher(rightBotName).find() && !dislikedNames.matcher(leftBotName).find()) { return -1; } - /* rest is sorted by name. */ - return leftBotName.compareToIgnoreCase(rightBotName); + return 0; } };