Package redempt.redlib.commandmanager
Class CommandParser
java.lang.Object
redempt.redlib.commandmanager.CommandParser
Used to get ContextProviders and CommandArgumentTypes for a command file, then parse it
-
Constructor Summary
ConstructorDescriptionCommandParser
(InputStream stream) Constructs a CommandParser to parse input from the given stream.CommandParser
(InputStream stream, Messages messages) Constructs a CommandParser to parse input from the given stream. -
Method Summary
Modifier and TypeMethodDescriptionparse()
Parses the command info from the streamsetArgTypes
(ArgType<?>... types) Sets the CommandArgumentTypes to be used when building this command.setContextProviders
(ContextProvider<?>... providers) Sets the ContextProviders to be used when building this command.
-
Constructor Details
-
CommandParser
Constructs a CommandParser to parse input from the given stream. UseJavaPlugin.getResource(java.lang.String)
for this- Parameters:
stream
- The stream to read the command info from
-
CommandParser
Constructs a CommandParser to parse input from the given stream. UseJavaPlugin.getResource(java.lang.String)
for this- Parameters:
stream
- The stream to read the command info frommessages
- The messages to be used to supply help messages with the helpmsg tag
-
-
Method Details
-
setArgTypes
Sets the CommandArgumentTypes to be used when building this command.- Parameters:
types
- The CommandArgumentTypes to be used- Returns:
- This CommandParser
-
setContextProviders
Sets the ContextProviders to be used when building this command.- Parameters:
providers
- The ContextProviders to be used- Returns:
- This CommandParser
-
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.
-