Package arc.util
Class CommandHandler
java.lang.Object
arc.util.CommandHandler
Parses command syntax.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static interface
static enum
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCommandHandler
(String prefix) Creates a command handler with a specific command prefix. -
Method Summary
Modifier and TypeMethodDescriptionhandleMessage
(String message) Handles a message with no additional parameters.handleMessage
(String message, Object params) Handles a message with optional extra parameters.register
(String text, String description, CommandHandler.CommandRunner<T> runner) Register a command which handles a zero-sized list of arguments and one parameter.register
(String text, String params, String description, CommandHandler.CommandRunner<T> runner) Register a command which handles a list of arguments and one handler-specific parameter.void
removeCommand
(String text) void
-
Field Details
-
prefix
-
-
Constructor Details
-
CommandHandler
Creates a command handler with a specific command prefix.
-
-
Method Details
-
setPrefix
-
getPrefix
-
handleMessage
Handles a message with no additional parameters. -
handleMessage
Handles a message with optional extra parameters. Runs the command if successful.- Returns:
- a response detailing whether or not the command was handled, and what went wrong, if applicable.
-
removeCommand
-
register
public <T> CommandHandler.Command register(String text, String description, CommandHandler.CommandRunner<T> runner) Register a command which handles a zero-sized list of arguments and one parameter. -
register
public <T> CommandHandler.Command register(String text, String params, String description, CommandHandler.CommandRunner<T> runner) Register a command which handles a list of arguments and one handler-specific parameter.
argeter syntax is as follows:
<mandatory-arg-1> <mandatory-arg-2> ... <mandatory-arg-n> [optional-arg-1] [optional-arg-2]
Angle brackets indicate mandatory arguments. Square brackets to indicate optional arguments.
All mandatory arguments must come before optional arguments. Arg names must not have spaces in them.
You may also use the ... syntax after the arg name to designate that everything after it will not be split into extra arguments. There may only be one such argument, and it must be at the end. For example, the syntax <arg1> [arg2...] will require a first argument, and then take any text after that and put it in the second argument, optionally. -
register
-
register
-
getCommandList
-