Class CommandParser

java.lang.Object
redempt.redlib.commandmanager.CommandParser

public class CommandParser extends Object
Used to get ContextProviders and CommandArgumentTypes for a command file, then parse it
  • Constructor Details

    • CommandParser

      public CommandParser(InputStream stream)
      Constructs a CommandParser to parse input from the given stream. Use JavaPlugin.getResource(java.lang.String) for this
      Parameters:
      stream - The stream to read the command info from
    • CommandParser

      public CommandParser(InputStream stream, Messages messages)
      Constructs a CommandParser to parse input from the given stream. Use JavaPlugin.getResource(java.lang.String) for this
      Parameters:
      stream - The stream to read the command info from
      messages - The messages to be used to supply help messages with the helpmsg tag
  • Method Details

    • setArgTypes

      public CommandParser setArgTypes(ArgType<?>... types)
      Sets the CommandArgumentTypes to be used when building this command.
      Parameters:
      types - The CommandArgumentTypes to be used
      Returns:
      This CommandParser
    • setContextProviders

      public CommandParser setContextProviders(ContextProvider<?>... providers)
      Sets the ContextProviders to be used when building this command.
      Parameters:
      providers - The ContextProviders to be used
      Returns:
      This CommandParser
    • parse

      public CommandCollection parse()
      Parses the command info from the stream
      Returns:
      A CommandCollection representing all the commands which were parsed. Use CommandCollection.register(String, Object...) to register all commands in it at once.