Class CommandManager

java.lang.Object
net.apartium.cocoabeans.commands.CommandManager

@NonExtendable public abstract class CommandManager extends Object
  • Field Details

    • COMMON_PARSERS

      public static final Set<ArgumentParser<?>> COMMON_PARSERS
    • commandMap

      protected final Map<String,net.apartium.cocoabeans.commands.RegisteredCommand> commandMap
  • Constructor Details

  • Method Details

    • registerArgumentTypeHandler

      public void registerArgumentTypeHandler(ArgumentParser<?> argumentTypeHandler)
    • registerArgumentTypeHandler

      public void registerArgumentTypeHandler(Set<ArgumentParser<?>> argumentTypeHandlers)
    • 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 override
      factory - the custom factory implementation to be registered
    • handleTabComplete

      public List<String> handleTabComplete(Sender sender, String commandName, String[] args)
    • handle

      public boolean handle(Sender sender, String commandName, String[] args) throws Throwable
      Throws:
      Throwable
    • addCommand

      public void addCommand(CommandNode commandNode)
    • addMetadataHandler

      @AvailableSince("0.0.39") public void addMetadataHandler(Function<Map<String,Object>,Set<Requirement>> metaDataHandler)
    • 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 added
      callback - function to be called each time the command has been run
    • getCommandInfo

      public CommandInfo getCommandInfo(String commandName)
    • addCommand

      protected abstract void addCommand(CommandNode commandNode, Command command)
    • getArgumentMapper

      public ArgumentMapper getArgumentMapper()
    • getCommandLexer

      public CommandLexer getCommandLexer()