 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.commands;
31 import org.jetbrains.annotations.NotNull;
69 public void execute(@NotNull
final String args) {
70 final String commandList;
71 final boolean perCharacterBinding;
72 if (args.equals(
"-c")) {
73 perCharacterBinding =
true;
75 }
else if (args.startsWith(
"-c ")) {
76 perCharacterBinding =
true;
79 perCharacterBinding =
false;
83 if (commandList.isEmpty()) {
91 drawInfoError(
"Cannot use bind -c since no character is logged in.");
101 final StringBuilder sb =
new StringBuilder();
102 sb.append(
"Binds a command to a key\n");
104 sb.append(
"Usage: bind <command>\n");
105 sb.append(
"Usage: bind -c <command>\n");
107 sb.append(
"Asks the user for a key, then associates the given <command> with that key.\n");
108 sb.append(
"If the option -c is used, the command is associated only with the current character. ");
109 sb.append(
"Otherwise the command is associated with all characters on all Crossfire servers.\n");
110 sb.append(
"The ESC key cannot be bound. Its fixed function is to cancel an action.\n");
111 sb.append(
"Note: Unbind a key: unbind\n");
112 return sb.toString();
GUICommand createCommand(@NotNull final String commandString)
Creates a new GUICommand instance from string representation.
final CommandCallback commandCallback
The CommandCallback to use.
final GUICommandFactory guiCommandFactory
The GUICommandFactory for creating commands.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
Abstract base class for Command implementations.
Implements the "bind" command.
BindCommand(@NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final CommandCallback commandCallback, @NotNull final GUICommandFactory guiCommandFactory)
Creates a new instance.
void drawInfoError(@NotNull final String message)
Displays an error message.
String getHelp()
Returns the help text for this command.
boolean createKeyBinding(boolean perCharacter, @NotNull CommandList commandList)
Adds a key binding.
boolean allArguments()
Returns whether all remaining commands should be included as arguments.
static String trimLeading(@NotNull final CharSequence str)
Removes leading whitespace from a string.
final CrossfireServerConnection crossfireServerConnection
The connection instance.
A list of GUICommand instances.
void execute(@NotNull final String args)
Executes the command with the given arguments.
Interface that defines callback functions needed by commands.
Utility class for string manipulation.
void add(@NotNull final GUICommand guiCommand)
Adds a command to the end of this command list.
Factory for creating GUICommand instances from string representation.
AND
List is executed if all entries can execute.