Crossfire JXClient, Trunk  R20561
BindingsCommand.java
Go to the documentation of this file.
1 package com.realtime.crossfire.jxclient.commands;
2 
6 import org.jetbrains.annotations.NotNull;
7 
13 public class BindingsCommand extends AbstractCommand {
14 
19 
25  public BindingsCommand(@NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final KeybindingsManager keybindingsManager) {
26  super("bindings", crossfireServerConnection);
27  this.keybindingsManager = keybindingsManager;
28  }
29 
33  @Override
34  public boolean allArguments() {
35  return false;
36  }
37 
41  @Override
42  public void execute(@NotNull final String args) {
43  final Iterable<KeyBinding> bindings = keybindingsManager.getBindingsForPartialCommand(args, false);
44  drawInfo("Keybindings:");
45  for (final KeyBinding binding : bindings) {
46  drawInfo(binding.getBindingDescription()+": "+binding.getCommandString());
47  }
48  }
49 
50 }
Abstract base class for Command implementations.
Iterable< KeyBinding > getBindingsForPartialCommand(@NotNull final String command, final boolean startOnly)
Searches bindings having a command text starting with the specified value.
final KeybindingsManager keybindingsManager
Where to find bindings information.
final CrossfireServerConnection crossfireServerConnection
The connection instance.
void execute(@NotNull final String args)
Executes the command with the given arguments.the command arguments
BindingsCommand(@NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final KeybindingsManager keybindingsManager)
Creates a new instance.
Implements the "bindings" command, listing currently active keybindings (for both a character and the...
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
void drawInfo(@NotNull final String message)
Displays a regular output message.
boolean allArguments()
Returns whether all remaining commands should be included as arguments.whether all remaining commands...