Don't repeat last command completion unless its prefixed repeat

This commit is contained in:
Aikar
2019-03-12 21:52:50 -04:00
parent 23dd046b8e
commit aa2e6ad1f8
@@ -177,8 +177,12 @@ public class CommandCompletions<C extends CommandCompletionContext> {
String completion = argIndex < completions.length ? completions[argIndex] : null;
if (completion == null && completions.length > 0) {
completion = completions[completions.length - 1];
String last = completions[completions.length - 1];
if (last.startsWith("repeat@")) {
completion = last;
}
}
if (completion == null) {
return Collections.singletonList(input);
}
@@ -187,6 +191,9 @@ public class CommandCompletions<C extends CommandCompletionContext> {
}
List<String> getCompletionValues(RegisteredCommand command, CommandIssuer sender, String completion, String[] args, boolean isAsync) {
if (completion.startsWith("repeat@")) {
completion = completion.substring(6);
}
completion = manager.getCommandReplacements().replace(completion);
List<String> allCompletions = new ArrayList<>();