Class CommandDispatcher

java.lang.Object
net.minestom.server.command.builder.CommandDispatcher

public class CommandDispatcher extends Object
Class responsible for parsing Command.
  • Constructor Details

    • CommandDispatcher

      public CommandDispatcher(CommandManager manager)
    • CommandDispatcher

      public CommandDispatcher()
  • Method Details

    • register

      public void register(Command command)
      Registers a command, be aware that registering a command name or alias will override the previous entry.
      Parameters:
      command - the command to register
    • unregister

      public void unregister(Command command)
    • getCommands

      public Set<Command> getCommands()
    • findCommand

      @Nullable public @Nullable Command findCommand(String commandName)
      Gets the command class associated with the name.
      Parameters:
      commandName - the command name
      Returns:
      the Command associated with the name, null if not any
    • execute

      public CommandResult execute(CommandSender source, String commandString)
      Checks if the command exists, and execute it.
      Parameters:
      source - the command source
      commandString - the command with the argument(s)
      Returns:
      the command result
    • parse

      public CommandResult parse(CommandSender sender, String commandString)
      Parses the given command.
      Parameters:
      commandString - the command (containing the command name and the args if any)
      Returns:
      the parsing result