Package co.aikar.commands
Class CommandContexts<R extends CommandExecutionContext<?,? extends CommandIssuer>>
java.lang.Object
co.aikar.commands.CommandContexts<R>
public class CommandContexts<R extends CommandExecutionContext<?,? extends CommandIssuer>>
extends Object
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Class<?>,
ContextResolver<?, R>> protected final CommandManager
-
Method Summary
Modifier and TypeMethodDescriptionContextResolver<?,
R> getResolver
(Class<?> type) <T> void
registerContext
(Class<T> context, ContextResolver<T, R> supplier) Registers a context that requires input from the command issuer to resolve.<T> void
registerIssuerAwareContext
(Class<T> context, IssuerAwareContextResolver<T, R> supplier) Registers a context resolver that may conditionally consume input, falling back to using the context of the issuer to potentially fulfill this context.<T> void
registerIssuerOnlyContext
(Class<T> context, IssuerOnlyContextResolver<T, R> supplier) Registers a context resolver that will never consume input.<T> void
registerOptionalContext
(Class<T> context, OptionalContextResolver<T, R> supplier) Registers a context that can safely accept a null input from the command issuer to resolve.<T> void
registerSenderAwareContext
(Class<T> context, IssuerAwareContextResolver<T, R> supplier) Deprecated.
-
Field Details
-
contextMap
protected final Map<Class<?>,ContextResolver<?, contextMapR extends CommandExecutionContext<?, ? extends CommandIssuer>>> -
manager
-
-
Method Details
-
registerSenderAwareContext
@Deprecated public <T> void registerSenderAwareContext(Class<T> context, IssuerAwareContextResolver<T, R> supplier) Deprecated.Please switch toregisterIssuerAwareContext(Class, IssuerAwareContextResolver)
as the core wants to use the platform-agnostic term of "Issuer" instead of Sender -
registerIssuerAwareContext
public <T> void registerIssuerAwareContext(Class<T> context, IssuerAwareContextResolver<T, R> supplier) Registers a context resolver that may conditionally consume input, falling back to using the context of the issuer to potentially fulfill this context. You may callCommandExecutionContext.getFirstArg()
and then conditionally callCommandExecutionContext.popFirstArg()
if you want to consume that input. -
registerIssuerOnlyContext
public <T> void registerIssuerOnlyContext(Class<T> context, IssuerOnlyContextResolver<T, R> supplier) Registers a context resolver that will never consume input. It will always satisfy its context based on the issuer of the command, so it will not appear in syntax strings. -
registerOptionalContext
Registers a context that can safely accept a null input from the command issuer to resolve. This resolver should always callCommandExecutionContext.popFirstArg()
-
registerContext
Registers a context that requires input from the command issuer to resolve. This resolver should always callCommandExecutionContext.popFirstArg()
-
getResolver
-
registerIssuerAwareContext(Class, IssuerAwareContextResolver)
as the core wants to use the platform-agnostic term of "Issuer" instead of Sender