mirror of
https://github.com/aikar/commands.git
synced 2026-05-31 06:11:55 +00:00
fix sponge tab complete API
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user