Package net.apartium.cocoabeans.commands
Class CommandManager
java.lang.Object
net.apartium.cocoabeans.commands.CommandManager
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommandManager(ArgumentMapper argumentMapper) protectedCommandManager(ArgumentMapper argumentMapper, CommandLexer commandLexer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCommand(CommandNode commandNode) protected abstract voidaddCommand(CommandNode commandNode, Command command) voidaddMetadataHandler(Function<Map<String, Object>, Set<Requirement>> metaDataHandler) voidaddVirtualCommand(VirtualCommandDefinition virtualCommandDefinition, Function<CommandContext, Boolean> callback) Add Virtual command with consumer that get called every time someone is running that commandgetCommandInfo(String commandName) booleanhandleTabComplete(Sender sender, String commandName, String[] args) voidregisterArgumentTypeHandler(Set<ArgumentParser<?>> argumentTypeHandlers) voidregisterArgumentTypeHandler(ArgumentParser<?> argumentTypeHandler) voidregisterRequirementFactory(Class<? extends Annotation> annotation, RequirementFactory factory) Registers an external requirement factory for a specific annotation.
-
Field Details
-
COMMON_PARSERS
-
commandMap
-
-
Constructor Details
-
CommandManager
-
CommandManager
-
-
Method Details
-
registerArgumentTypeHandler
-
registerArgumentTypeHandler
-
registerRequirementFactory
@AvailableSince("0.0.38") public void registerRequirementFactory(Class<? extends Annotation> annotation, RequirementFactory factory) Registers an external requirement factory for a specific annotation.This allows overriding the default behavior of the annotation with a custom factory implementation. Note that this registration only affects commands registered after the factory is set. Commands registered prior to this change will continue to use their previously assigned implementation.
- Parameters:
annotation- the annotation class to overridefactory- the custom factory implementation to be registered
-
handleTabComplete
-
handle
- Throws:
Throwable
-
addCommand
-
addMetadataHandler
-
addVirtualCommand
@AvailableSince("0.0.39") public void addVirtualCommand(VirtualCommandDefinition virtualCommandDefinition, Function<CommandContext, Boolean> callback) Add Virtual command with consumer that get called every time someone is running that command- Parameters:
virtualCommandDefinition- virtual command to be addedcallback- function to be called each time the command has been run
-
getCommandInfo
-
addCommand
-
getArgumentMapper
-
getCommandLexer
-