Class CommandEngine

java.lang.Object
net.orbyfied.j8.command.CommandEngine
Direct Known Subclasses:
BukkitCommandEngine

public abstract class CommandEngine extends Object
The engine of the command system.
  • Constructor Details

    • CommandEngine

      public CommandEngine()
  • Method Details

    • register

      public CommandEngine register(Node command)
    • unregister

      public CommandEngine unregister(Node command)
    • setTypeResolver

      public CommandEngine setTypeResolver(TypeResolver resolver)
      Set the type resolver.
      Parameters:
      resolver - It.
      Returns:
      This.
    • getTypeResolver

      public TypeResolver getTypeResolver()
      Get the type resolver.
      Returns:
      It.
    • registerPlatform

      protected abstract void registerPlatform(Node root)
      Should do whatever it needs to do when a node gets registered to make it work.
      Parameters:
      root - The command node.
    • unregisterPlatform

      protected abstract void unregisterPlatform(Node root)
      Should do whatever it needs to do when a node gets unregistered to make it work.
      Parameters:
      root - The command node.
    • enablePlatform

      public abstract void enablePlatform()
      Should prepare the command engine for usage. Called whenever the system is ready for operation.
    • disablePlatform

      public abstract void disablePlatform()
      Should shut down the command engine and clean up any resources.
    • dispatch

      public Context dispatch(org.bukkit.command.CommandSender sender, String str, SuggestionAccumulator suggestions, Consumer<Context> ctxConsumer)
      Dispatches a suggestion or invocation request for a command.
      Parameters:
      sender - The command sender.
      str - The command string.
      suggestions - The suggestion builder. If this is null, the request is invocation, otherwise the request will be set to suggestion.
      ctxConsumer - A consumer for configuring the context.
      Returns:
      The context for optional further use.
    • command

      public Node command(String name)
      Creates and registers a new command, returning the base to you.
      Parameters:
      name - The name.
      Returns:
      The command node.