Package D3.Account

Examples of D3.Account.Account$Digest


  @Override
  public EconomyResponse bankHas(String name, double amount) {

    if (Common.getInstance().getAccountManager().exist(Account.BANK_PREFIX + name)) {
      Account account = Common.getInstance().getAccountManager().getAccount(Account.BANK_PREFIX + name);
      if (account.hasEnough(amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
        return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.SUCCESS, "");
      } else {
        return new EconomyResponse(0, bankBalance(Account.BANK_PREFIX + name).balance, ResponseType.FAILURE, "The bank does not have enough money!");
      }
    }
View Full Code Here


    EconomyResponse er = isBankOwner(name, playerName);
    if (er.transactionSuccess()) {
      return er;
    } else {
      if (Common.getInstance().getAccountManager().exist(Account.BANK_PREFIX + name)) {
        Account account = Common.getInstance().getAccountManager().getAccount(Account.BANK_PREFIX + name);
        if (account.getAccountACL().canDeposit(playerName) && account.getAccountACL().canWithdraw(playerName)) {
          return new EconomyResponse(0, bankBalance(name).balance, ResponseType.SUCCESS, "");
        }
      }
      return new EconomyResponse(0, 0, ResponseType.FAILURE, "This player is not a member of the bank!");
    }
View Full Code Here

    if (amount < 0) {
      return new EconomyResponse(0, getBalance(playerName, worldName), ResponseType.FAILURE, "Cannot withdraw negative funds");
    }

    double balance;
    Account account = Common.getInstance().getAccountManager().getAccount(playerName);
    if (account.hasEnough(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName())) {
      balance = account.withdraw(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName(), Cause.VAULT, null);
      return new EconomyResponse(amount, balance, ResponseType.SUCCESS, "");
    } else {
      return new EconomyResponse(0, getBalance(playerName, worldName), ResponseType.FAILURE, "Insufficient funds");
    }
  }
View Full Code Here

  public EconomyResponse depositPlayer(String playerName, String worldName, double amount) {
    if (amount < 0) {
      return new EconomyResponse(0, getBalance(playerName, worldName), ResponseType.FAILURE, "Cannot desposit negative funds");
    }

    Account account = Common.getInstance().getAccountManager().getAccount(playerName);

    double balance = account.deposit(amount, worldName, Common.getInstance().getCurrencyManager().getDefaultCurrency().getName(), Cause.VAULT, null);
    return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null);
  }
View Full Code Here

TOP

Related Classes of D3.Account.Account$Digest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.