fix sponge tab complete API

This commit is contained in:
Aikar
2018-03-16 16:48:24 -04:00
parent 2d0995a3ac
commit 7353aa0b2e
2 changed files with 3 additions and 2 deletions
@@ -496,6 +496,7 @@ public abstract class BaseCommand {
List<String> getCommandsForCompletion(CommandIssuer issuer, String[] args) {
final Set<String> cmds = new HashSet<>();
final int cmdIndex = Math.max(0, args.length - 1);
String argString = ApacheCommonsLangUtil.join(args, " ").toLowerCase();
for (Map.Entry<String, RegisteredCommand> entry : subCommands.entries()) {
final String key = entry.getKey();
@@ -506,7 +507,7 @@ public abstract class BaseCommand {
}
String[] split = ACFPatterns.SPACE.split(value.prefSubCommand);
cmds.add(split[args.length - 1]);
cmds.add(split[cmdIndex]);
}
}
return new ArrayList<>(cmds);
@@ -66,7 +66,7 @@ public class SpongeRootCommand implements CommandCallable, RootCommand {
@Override
public List<String> getSuggestions(@NotNull CommandSource source, @NotNull String arguments, @Nullable Location<World> location) throws CommandException {
String[] args = arguments.isEmpty() ? new String[0] : arguments.split(" ");
String[] args = arguments.isEmpty() ? new String[]{""} : arguments.split(" ");
return getTabCompletions(manager.getCommandIssuer(source), this.name, args);
}