use of com.freya02.botcommands.internal.prefixed.TextSubcommandCandidates in project BotCommands by freya022.
the class BContextImpl method addTextCommand.
public void addTextCommand(TextCommandInfo commandInfo) {
final CommandPath path = commandInfo.getPath();
final List<CommandPath> aliases = commandInfo.getAliases();
textCommandMap.compute(path, (k, v) -> {
if (v == null)
return new TextCommandCandidates(commandInfo);
else
v.add(commandInfo);
return v;
});
final CommandPath parentPath = path.getParent();
if (parentPath != null) {
// Add subcommands to cache
// If subcommands candidates exist, append, if not then create
textSubcommandsMap.compute(parentPath, (x, candidates) -> (candidates == null) ? new TextSubcommandCandidates(commandInfo) : candidates.addSubcommand(commandInfo));
}
for (CommandPath alias : aliases) {
textCommandMap.compute(alias, (k, v) -> {
if (v == null)
return new TextCommandCandidates(commandInfo);
else
v.add(commandInfo);
return v;
});
}
}
Aggregations