mirror of
https://github.com/aikar/commands.git
synced 2026-05-31 06:11:55 +00:00
Do not filter out valid completion arguments
Fixes a bug introduced by PR 200. The bug related to the Values annotation which uses this getCompletionValues method also. This is definitely not the propersolution. The underlying issue is related to the logic calling `args` which is the original argument array. And it should not be using arguments which have been resolved in a previous parameter. I was not able to find a quick/simple way to accommodate that issue.
This commit is contained in:
@@ -263,12 +263,13 @@ public class CommandCompletions<C extends CommandCompletionContext> {
|
||||
&& args.length > ACFPatterns.SPACE.split(command.complete).length) {
|
||||
String start = String.join(" ", args);
|
||||
completions = completions.stream()
|
||||
.filter(s -> s != null && s.split(" ").length >= args.length)
|
||||
.filter(s -> ApacheCommonsLangUtil.startsWithIgnoreCase(s, start))
|
||||
.map(s -> {
|
||||
String[] completionArgs = s.split(" ");
|
||||
return String.join(" ",
|
||||
Arrays.copyOfRange(completionArgs, args.length - 1, completionArgs.length));
|
||||
if (s != null && s.split(" ").length >= args.length && ApacheCommonsLangUtil.startsWithIgnoreCase(s, start)) {
|
||||
String[] completionArgs = s.split(" ");
|
||||
return String.join(" ", Arrays.copyOfRange(completionArgs, args.length - 1, completionArgs.length));
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user