@In
private InputSystem inputSystem;
@Command(shortDescription = "Maps a key to a function")
public String bindKey(@CommandParam("key") String key, @CommandParam("function") String bind) {
Input keyInput = Keyboard.Key.find(key);
if (keyInput != null) {
inputSystem.linkBindButtonToKey(keyInput.getId(), new SimpleUri(bind));
StringBuilder builder = new StringBuilder();
builder.append("Mapped ").append(keyInput.getDisplayName()).append(" to action ");
builder.append(bind);
return builder.toString();
}
throw new IllegalArgumentException("Unknown key: " + key);
}