made queue command filter completion
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
version = "2.0.7-pre1"
|
version = "2.0.7-pre2"
|
||||||
group = "us.ajg0702"
|
group = "us.ajg0702"
|
||||||
|
|
||||||
plugins.apply("java")
|
plugins.apply("java")
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ import us.ajg0702.queue.api.commands.ICommandSender;
|
|||||||
import us.ajg0702.queue.api.commands.ISubCommand;
|
import us.ajg0702.queue.api.commands.ISubCommand;
|
||||||
import us.ajg0702.utils.common.Messages;
|
import us.ajg0702.utils.common.Messages;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BaseCommand implements IBaseCommand {
|
public class BaseCommand implements IBaseCommand {
|
||||||
@Override
|
@Override
|
||||||
@@ -64,4 +66,9 @@ public class BaseCommand implements IBaseCommand {
|
|||||||
public List<String> autoComplete(ICommandSender sender, String[] args) {
|
public List<String> autoComplete(ICommandSender sender, String[] args) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> filterCompletion(List<String> in, String current) {
|
||||||
|
in.removeIf(t -> !t.toLowerCase(Locale.ROOT).contains(current.toLowerCase(Locale.ROOT)));
|
||||||
|
return in;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class QueueCommand extends BaseCommand {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
if(args.length == 1) {
|
if(args.length == 1) {
|
||||||
return main.getQueueManager().getServerNames();
|
return filterCompletion(main.getQueueManager().getServerNames(), args[0]);
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user