-
-
Notifications
You must be signed in to change notification settings - Fork 149
Using ACF
See Maven, Gradle, or you can find artifacts here:
Or manual: https://repo.aikar.co/nexus/content/groups/aikar/co/aikar/
This part is platform specific. Use the command manager that represents your platform.
BukkitCommandManager manager = new BukkitCommandManager(yourBukkitPlugin);First you need to create a class that extends BaseCommand, then register that command with the manager
manager.registerCommand(new MyCommand());If you need your plugin instance, pass it to your commands constructor like so
manager.registerCommand(new MyCommand(myPlugin));Command Context Handlers are able to resolve input to custom Java objects.
To register your own custom ones, one would do
manager.getCommandContexts().registerContext(Foo.class, c -> {
return /* stuff */;
});See CommandExecutionContext for information on what methods are available for (c) See CommandContexts and BukkitCommandContexts for examples.
You may also use registerIssuerAwareContext instead to tell ACF that this resolver is able to resolve without consuming input, by understanding the context of the issuer of the command (such as World, Location, Etc)
A non issuer aware resolver must consume input. Issuer Aware may optionally consume input if supplied, and fallback to context if not.
If you want an Issuer Only resolver, one that always resolves based on Issuer and never consumes input, you may use registerIssuerOnlyContext