コード例 #1
0
  @ReceiveEvent(components = ClientComponent.class, netFilter = RegisterMode.AUTHORITY)
  public void onCommand(CommandEvent event, EntityRef entity) {
    List<String> params = event.getParameters();
    ConsoleCommand cmd = console.getCommand(event.getCommandName());

    if (cmd.getRequiredParameterCount() == params.size() && cmd.isRunOnServer()) {
      console.execute(event.getCommandName(), event.getParameters(), entity);
    }
  }
コード例 #2
0
  public Event getEvent(CommandSender sender, Command command, String label, String[] args) {
    CommandEvent event = null;

    if (command.equals("ccBalance")) {
      event = new BalanceEvent();
      event.setSender(sender);
      event.setLabel(label);
      event.setArgs(args);
      event.setCommand(command);
    }

    return event;
  }