 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.commands;
30 import org.jetbrains.annotations.NotNull;
31 import org.jetbrains.annotations.Nullable;
63 public void execute(@NotNull
final String args) {
66 }
else if (args.startsWith(
"-d ")) {
79 final String text = shortcut ==
null ?
"(empty)" : shortcut.
getCommand();
90 if (shortcutSlot !=
null) {
100 final String[] tmp = args.split(
" ", 2);
102 if (shortcutSlot !=
null) {
111 final StringBuilder sb =
new StringBuilder();
112 sb.append(
"Updates the shortcut bar\n");
114 sb.append(
"Usage: shortcut\n");
115 sb.append(
"Usage: shortcut <key> <command>\n");
116 sb.append(
"Usage: shortcut -d <key>\n");
118 sb.append(
"Without argument shows the contents of the shortcut bar. ");
119 sb.append(
"Otherwise replaces the slot for <key> with <command>. ");
120 sb.append(
"<key> may be F1, F2, ..., F12. Other keys are not supported.\n");
121 sb.append(
"-d removes the command from the given slot.\n");
122 return sb.toString();
134 }
catch (
final IllegalArgumentException ignored) {
String getCommand()
Returns the command to execute.
A slot in the shortcuts bar.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
Implements the "shortcut" command.
Shortcut getShortcut(@NotNull final ShortcutSlot shortcutSlot)
Returns a shortcut.
Abstract base class for Command implementations.
void updateSlot(@NotNull final String args)
Updates a slot.
final Shortcuts shortcuts
The shortcuts to use.
void setShortcutString(@NotNull final ShortcutSlot shortcutSlot, @NotNull final String command, final boolean saveChanges)
Sets a slot.
void drawInfoError(@NotNull final String message)
Displays an error message.
String getHelp()
Returns the help text for this command.
void deleteSlot(@NotNull final String args)
Clears a slot.
ShortcutSlot parseKey(@NotNull final String args)
Parses a key name.
Abstract base class for shortcut commands.
static String trimLeading(@NotNull final CharSequence str)
Removes leading whitespace from a string.
void listSlots()
Lists all shortcuts.
ShortcutCommand(@NotNull final Shortcuts shortcuts, @NotNull final CrossfireServerConnection crossfireServerConnection)
Creates a new instance.
final CrossfireServerConnection crossfireServerConnection
The connection instance.
void execute(@NotNull final String args)
Executes the command with the given arguments.
Utility class for string manipulation.
void drawInfo(@NotNull final String message)
Displays a regular output message.
Manages a list of Shortcuts.
boolean allArguments()
Returns whether all remaining commands should be included as arguments.