Exemple #1
0
  @Override
  public EconomyResponse bankBalance(String name) {
    if (!economy.bankExists(name)) {
      return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
    }

    double bankMoney = economy.getBankMoney(name);
    return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, null);
  }
Exemple #2
0
 @Override
 public EconomyResponse isBankMember(String name, String playerName) {
   if (!economy.bankExists(name)) {
     return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
   } else if (economy.isBankMember(name, playerName)) {
     return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, "");
   } else
     return new EconomyResponse(0, 0, ResponseType.FAILURE, "That player is not a bank member!");
 }
Exemple #3
0
  @Override
  public EconomyResponse createBank(String name, String player) {
    boolean success = economy.addBankOwner(name, player, false);
    if (success) {
      return new EconomyResponse(0, economy.getBankMoney(name), ResponseType.SUCCESS, "");
    }

    return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to create that bank account.");
  }
Exemple #4
0
 @Override
 public EconomyResponse bankDeposit(String name, double amount) {
   if (!economy.bankExists(name)) {
     return new EconomyResponse(amount, 0, ResponseType.FAILURE, "That bank does not exist!");
   } else {
     economy.addBankMoney(name, (int) amount, true);
     return new EconomyResponse(
         (int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, "");
   }
 }
Exemple #5
0
 @Override
 public EconomyResponse bankWithdraw(String name, double amount) {
   EconomyResponse er = bankHas(name, amount);
   if (!er.transactionSuccess()) {
     return er;
   } else {
     economy.addBankMoney(name, (int) -amount, true);
     return new EconomyResponse(
         (int) amount, economy.getBankMoney(name), ResponseType.SUCCESS, "");
   }
 }
Exemple #6
0
  @Override
  public EconomyResponse bankHas(String name, double amount) {
    if (!economy.bankExists(name)) {
      return new EconomyResponse(0, 0, ResponseType.FAILURE, "That bank does not exist!");
    }

    double bankMoney = economy.getBankMoney(name);
    if (bankMoney < amount) {
      return new EconomyResponse(
          0, bankMoney, ResponseType.FAILURE, "The bank does not have enough money!");
    } else {
      return new EconomyResponse(0, bankMoney, ResponseType.SUCCESS, "");
    }
  }
Exemple #7
0
 @SuppressWarnings("deprecation")
 public double balance() {
   return Double.valueOf(BOSEconomy.getBankMoney(name));
 }