✨ Register a parser supplier for UserArgument
This commit is contained in:
parent
979d1079c6
commit
f0feaf4e13
1 changed files with 6 additions and 0 deletions
|
|
@ -31,6 +31,8 @@ import cloud.commandframework.execution.AsynchronousCommandExecutionCoordinator;
|
||||||
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||||
import cloud.commandframework.internal.CommandRegistrationHandler;
|
import cloud.commandframework.internal.CommandRegistrationHandler;
|
||||||
import cloud.commandframework.meta.CommandMeta;
|
import cloud.commandframework.meta.CommandMeta;
|
||||||
|
import cloud.commandframework.pircbotx.arguments.UserArgument;
|
||||||
|
import io.leangen.geantyref.TypeToken;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||||
import org.pircbotx.PircBotX;
|
import org.pircbotx.PircBotX;
|
||||||
import org.pircbotx.User;
|
import org.pircbotx.User;
|
||||||
|
|
@ -109,6 +111,10 @@ public class PircBotXCommandManager<C> extends CommandManager<C> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.registerCommandPreProcessor(context -> context.getCommandContext().store(PIRCBOTX_META_KEY, pircBotX));
|
this.registerCommandPreProcessor(context -> context.getCommandContext().store(PIRCBOTX_META_KEY, pircBotX));
|
||||||
|
this.getParserRegistry().registerParserSupplier(
|
||||||
|
TypeToken.get(User.class),
|
||||||
|
parameters -> new UserArgument.UserArgumentParser<>()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue