예제 #1
0
 public BOSEAdapter(BOSEconomy p) {
   plugin = p;
   String serverland = Residence.getServerLandname();
   if (!plugin.playerRegistered(serverland, false)) {
     plugin.registerPlayer(serverland);
   }
 }
예제 #2
0
  @Override
  public EconomyResponse depositPlayer(String playerName, double amount) {
    double balance;
    EconomyResponse.ResponseType type;
    String errorMessage = null;

    if (amount < 0) {
      errorMessage = "Cannot deposit negative funds";
      type = EconomyResponse.ResponseType.FAILURE;
      amount = 0;
      balance = (double) economy.getPlayerMoney(playerName);

      return new EconomyResponse(balance, balance, type, errorMessage);
    }
    amount = Math.ceil(amount);
    balance = (double) economy.getPlayerMoney(playerName);
    if (economy.setPlayerMoney(playerName, (int) (balance + amount), false)) {
      type = EconomyResponse.ResponseType.SUCCESS;
      balance = (double) economy.getPlayerMoney(playerName);

      return new EconomyResponse(amount, balance, type, errorMessage);
    } else {
      errorMessage = "Error withdrawing funds";
      type = EconomyResponse.ResponseType.FAILURE;
      amount = 0;
      balance = (double) economy.getPlayerMoney(playerName);

      return new EconomyResponse(balance, balance, type, errorMessage);
    }
  }
예제 #3
0
 @Override
 public boolean createPlayerAccount(String playerName) {
   if (economy.playerRegistered(playerName, false)) {
     return false;
   }
   return economy.registerPlayer(playerName);
 }
예제 #4
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 public String format(double amount) {
   String currency = BOSEconomy.getMoneyNamePlural();
   if (amount == 1) {
     currency = BOSEconomy.getMoneyName();
   }
   return amount + " " + currency;
 }
예제 #5
0
 @Override
 public boolean subtract(String playerName, double amount) {
   if (canAfford(playerName, amount)) {
     return plugin.setPlayerMoney(
         playerName, plugin.getPlayerMoneyDouble(playerName) - amount, false);
   }
   return false;
 }
예제 #6
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.");
  }
예제 #7
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);
  }
예제 #8
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!");
 }
예제 #9
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, "");
   }
 }
예제 #10
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, "");
   }
 }
예제 #11
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, "");
    }
  }
예제 #12
0
 @Override
 public EconomyResponse deleteBank(String name) {
   boolean success = economy.removeBank(name);
   if (success) {
     return new EconomyResponse(0, 0, ResponseType.SUCCESS, "");
   }
   return new EconomyResponse(0, 0, ResponseType.FAILURE, "Unable to remove that bank account.");
 }
예제 #13
0
 @Override
 public boolean isEnabled() {
   if (economy == null) {
     return false;
   } else {
     return economy.isEnabled();
   }
 }
예제 #14
0
 @Override
 public boolean canAfford(String playerName, double amount) {
   double balance = plugin.getPlayerMoneyDouble(playerName);
   if (balance >= amount) {
     return true;
   }
   return false;
 }
예제 #15
0
 @Override
 public double getBalance(String playerName) {
   return (double) economy.getPlayerMoney(playerName);
 }
예제 #16
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 public boolean remove() {
   return BOSEconomy.removeBank(bank);
 }
예제 #17
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 @SuppressWarnings("deprecation")
 public boolean divide(double amount) {
   int IntAmount = (int) Math.ceil(amount);
   int balance = (int) balance();
   return BOSEconomy.setBankMoney(name, (balance / IntAmount), false);
 }
예제 #18
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 @SuppressWarnings("deprecation")
 public boolean set(double amount) {
   int IntAmount = (int) Math.ceil(amount);
   return BOSEconomy.setBankMoney(name, IntAmount, true);
 }
예제 #19
0
 @Override
 public List<String> getBanks() {
   return economy.getBankList();
 }
예제 #20
0
 @Override
 public boolean add(String playerName, double amount) {
   return plugin.setPlayerMoney(
       playerName, plugin.getPlayerMoneyDouble(playerName) + amount, false);
 }
예제 #21
0
 @Override
 public boolean hasAccount(String playerName) {
   return economy.playerRegistered(playerName, false);
 }
예제 #22
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 @SuppressWarnings("deprecation")
 public boolean add(double amount) {
   int IntAmount = (int) Math.ceil(amount);
   return BOSEconomy.addPlayerMoney(name, IntAmount, false);
 }
예제 #23
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 public boolean hasBankAccount(String bank, String name) {
   return BOSEconomy.isBankOwner(bank, name);
 }
예제 #24
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 public boolean hasBank(String bank) {
   return BOSEconomy.bankExists(bank);
 }
예제 #25
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 public boolean hasAccount(String name) {
   return BOSEconomy.playerRegistered(name, false);
 }
예제 #26
0
 @Override
 public String currencyNamePlural() {
   return economy.getMoneyNamePlural();
 }
예제 #27
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 @SuppressWarnings("deprecation")
 public double balance() {
   return Double.valueOf(BOSEconomy.getPlayerMoney(name));
 }
예제 #28
0
 @Override
 public double getBalance(String playerName) {
   return plugin.getPlayerMoneyDouble(playerName);
 }
예제 #29
0
파일: BOSE.java 프로젝트: waffletastic/OKB3
 @SuppressWarnings("deprecation")
 public boolean subtract(double amount) {
   int IntAmount = (int) Math.ceil(amount);
   int balance = (int) balance();
   return BOSEconomy.setPlayerMoney(name, (balance - IntAmount), false);
 }
예제 #30
0
 @Override
 public String currencyNameSingular() {
   return economy.getMoneyName();
 }