use of baritone.api.command.helpers.TabCompleteHelper in project baritone by cabaletta.
the class CommandManager method tabComplete.
@Override
public Stream<String> tabComplete(String prefix) {
Tuple<String, List<ICommandArgument>> pair = expand(prefix, true);
String label = pair.getFirst();
List<ICommandArgument> args = pair.getSecond();
if (args.isEmpty()) {
return new TabCompleteHelper().addCommands(this.baritone.getCommandManager()).filterPrefix(label).stream();
} else {
return tabComplete(pair);
}
}
use of baritone.api.command.helpers.TabCompleteHelper in project Spark-Client by Spark-Client-Development.
the class ExampleBaritoneControl method tabComplete.
public Stream<String> tabComplete(String msg) {
try {
List<ICommandArgument> args = CommandArguments.from(msg, true);
ArgConsumer argc = new ArgConsumer(this.manager, args);
if (argc.hasAtMost(2)) {
if (argc.hasExactly(1)) {
return new TabCompleteHelper().addCommands(this.manager).addSettings().filterPrefix(argc.getString()).stream();
}
Settings.Setting setting = settings.byLowerName.get(argc.getString().toLowerCase(Locale.US));
if (setting != null) {
if (setting.getValueClass() == Boolean.class) {
TabCompleteHelper helper = new TabCompleteHelper();
if ((Boolean) setting.getValue()) {
helper.append("true", "false");
} else {
helper.append("false", "true");
}
return helper.filterPrefix(argc.getString()).stream();
} else {
return Stream.of(SettingsUtil.settingValueToString(setting));
}
}
}
return this.manager.tabComplete(msg);
} catch (CommandNotEnoughArgumentsException ignored) {
// Shouldn't happen, the operation is safe
return Stream.empty();
}
}
use of baritone.api.command.helpers.TabCompleteHelper in project Spark-Client by Spark-Client-Development.
the class CommandManager method tabComplete.
@Override
public Stream<String> tabComplete(String prefix) {
Tuple<String, List<ICommandArgument>> pair = expand(prefix, true);
String label = pair.getFirst();
List<ICommandArgument> args = pair.getSecond();
if (args.isEmpty()) {
return new TabCompleteHelper().addCommands(this.baritone.getCommandManager()).filterPrefix(label).stream();
} else {
return tabComplete(pair);
}
}
use of baritone.api.command.helpers.TabCompleteHelper in project baritone by cabaletta.
the class ExampleBaritoneControl method tabComplete.
public Stream<String> tabComplete(String msg) {
try {
List<ICommandArgument> args = CommandArguments.from(msg, true);
ArgConsumer argc = new ArgConsumer(this.manager, args);
if (argc.hasAtMost(2)) {
if (argc.hasExactly(1)) {
return new TabCompleteHelper().addCommands(this.manager).addSettings().filterPrefix(argc.getString()).stream();
}
Settings.Setting setting = settings.byLowerName.get(argc.getString().toLowerCase(Locale.US));
if (setting != null && !SettingsUtil.javaOnlySetting(setting)) {
if (setting.getValueClass() == Boolean.class) {
TabCompleteHelper helper = new TabCompleteHelper();
if ((Boolean) setting.value) {
helper.append("true", "false");
} else {
helper.append("false", "true");
}
return helper.filterPrefix(argc.getString()).stream();
} else {
return Stream.of(SettingsUtil.settingValueToString(setting));
}
}
}
return this.manager.tabComplete(msg);
} catch (CommandNotEnoughArgumentsException ignored) {
// Shouldn't happen, the operation is safe
return Stream.empty();
}
}
Aggregations