Match current command input for sub argument tab completions (#3496)

This commit is contained in:
EnZaXD 2023-10-24 02:02:08 +02:00 committed by GitHub
parent 78c7f03923
commit 2c6e18e4fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -125,7 +125,15 @@ public abstract class ViaCommandHandler implements ViaVersionCommand {
List<String> tab = sub.onTabComplete(sender, subArgs);
Collections.sort(tab);
return tab;
if (!tab.isEmpty()) {
final String currArg = subArgs[subArgs.length - 1];
for (String s : tab) {
if (s.toLowerCase(Locale.ROOT).startsWith(currArg.toLowerCase(Locale.ROOT))) {
output.add(s);
}
}
}
return output;
}
}
return output;

View File

@ -71,7 +71,6 @@ public class DebugSubCmd extends ViaSubCommand {
@Override
public List<String> onTabComplete(final ViaCommandSender sender, final String[] args) {
if (args.length == 1) {
//TODO match current input
return Arrays.asList("clear", "logposttransform", "add", "remove");
}
return Collections.emptyList();