 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.commands;
30 import java.util.Map.Entry;
31 import org.jetbrains.annotations.NotNull;
61 public void execute(@NotNull
final String args) {
63 if (tmp.length != 2) {
64 drawInfoError(
"The set command needs two arguments: set <option> <value>");
68 final String optionName = tmp[0];
69 final String optionArgs = tmp[1];
78 final boolean checked;
89 drawInfoError(
"The '"+optionArgs+
"' for option '"+optionName+
"' is invalid. Valid arguments are 'on' or 'off'.");
99 final StringBuilder sb =
new StringBuilder();
100 sb.append(
"Configures an option value\n");
102 sb.append(
"Usage: set <name> on\n");
103 sb.append(
"Usage: set <name> off\n");
105 sb.append(
"Valid option names are:\n");
107 sb.append(
"- ").append(option.getKey()).append(
": ").append(option.getValue().getDocumentation()).append(
"\n");
109 return sb.toString();
void execute(@NotNull final String args)
Executes the command with the given arguments.
SetCommand(@NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final OptionManager optionManager)
Creates a new instance.
final OptionManager optionManager
The option manager instance.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
Abstract base class for Command implementations.
CheckBoxOption getCheckBoxOption(@NotNull final String optionName)
Returns a checkbox option.
void drawInfoError(@NotNull final String message)
Displays an error message.
Maintains a set of named options.
String getHelp()
Returns the help text for this command.
void setChecked(final boolean checked)
Sets the current state.
Utility class containing useful Patterns.
final CrossfireServerConnection crossfireServerConnection
The connection instance.
boolean allArguments()
Returns whether all remaining commands should be included as arguments.
Implements the command "set".
Map< String, Entry > getOptions()
Returns all defined option names.
The base class for all check box options.
Indicates about an incorrect option.
static final Pattern PATTERN_WHITESPACE
The pattern to split a command from arguments, and to split arguments.