made queue command filter completion
This commit is contained in:
@@ -7,7 +7,9 @@ import us.ajg0702.queue.api.commands.ICommandSender;
|
||||
import us.ajg0702.queue.api.commands.ISubCommand;
|
||||
import us.ajg0702.utils.common.Messages;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BaseCommand implements IBaseCommand {
|
||||
@Override
|
||||
@@ -64,4 +66,9 @@ public class BaseCommand implements IBaseCommand {
|
||||
public List<String> autoComplete(ICommandSender sender, String[] args) {
|
||||
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<>();
|
||||
}
|
||||
if(args.length == 1) {
|
||||
return main.getQueueManager().getServerNames();
|
||||
return filterCompletion(main.getQueueManager().getServerNames(), args[0]);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user