Skip to content
William 'psyFi' Hatcher edited this page Oct 25, 2019 · 2 revisions

Registering Command Context Handlers

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