예제 #1
0
  public void execute(CommandSender sender)
      throws CommandArgumentException, CommandPermissionException, CommandUsageException {

    if (playerName != null) {
      account = handler.getPlayerPersonalAccount(playerName);
      if (account == null)
        throw new CommandUsageException(
            this.plugin.getSimpleFormattedMessage("player-has-no-personal-account", playerName));
      this.alterBalance();
      Object[] tokens = {playerName, handler.formatAmount(account.getBalance())};
      sender.sendMessage(
          plugin.getSimpleFormattedMessage("setcommand-personal-account-success", tokens));
    } else {
      account = handler.getAccount(accountNumber);
      if (account == null)
        throw new CommandUsageException(this.plugin.getMessage("account-does-not-exist"));
      this.alterBalance();
      Object[] tokens = {accountNumber, handler.formatAmount(account.getBalance())};
      sender.sendMessage(
          plugin.getSimpleFormattedMessage("setcommand-bank-account-success", tokens));
    }
  }