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
Fields Modifier and Type Field Description protected Map<Class<?>,ContextResolver<?,R>>contextMapprotected CommandManagermanager
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ContextResolver<?,R>getResolver(Class<?> type)<T> voidregisterContext(Class<T> context, ContextResolver<T,R> supplier)Registers a context that requires input from the command issuer to resolve.<T> voidregisterIssuerAwareContext(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> voidregisterIssuerOnlyContext(Class<T> context, IssuerOnlyContextResolver<T,R> supplier)Registers a context resolver that will never consume input.<T> voidregisterOptionalContext(Class<T> context, OptionalContextResolver<T,R> supplier)Registers a context that can safely accept a null input from the command issuer to resolve.<T> voidregisterSenderAwareContext(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
-
-
-
Field Detail
-
contextMap
protected final Map<Class<?>,ContextResolver<?,R extends CommandExecutionContext<?,? extends CommandIssuer>>> contextMap
-
manager
protected final CommandManager manager
-
-
Method Detail
-
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
public <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. This resolver should always callCommandExecutionContext.popFirstArg()
-
registerContext
public <T> void registerContext(Class<T> context, ContextResolver<T,R> supplier)
Registers a context that requires input from the command issuer to resolve. This resolver should always callCommandExecutionContext.popFirstArg()
-
getResolver
public ContextResolver<?,R> getResolver(Class<?> type)
-
-