@Override public void execute(String sender, String[] args) { if (Common.getInstance().getAccountManager().exist(Account.BANK_PREFIX + args[0])) { Account account = Common.getInstance().getAccountManager().getAccount(Account.BANK_PREFIX + args[0]); if (account.getAccountACL().canShow(sender) || Common.getInstance() .getServerCaller() .getPlayerCaller() .checkPermission(sender, "craftconomy.bank.balance.others")) { Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().getLanguageManager().getString("bank_statement")); Iterator<Balance> balanceList = account.getAllBalance().iterator(); while (balanceList.hasNext()) { Balance bl = balanceList.next(); Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().format(bl.getWorld(), bl.getCurrency(), bl.getBalance())); } } else { Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().getLanguageManager().getString("cant_check_bank_statement")); } } else { Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().getLanguageManager().getString("account_not_exist")); } }
@Override public void execute(String sender, String[] args) { if (Common.getInstance().getAccountManager().exist(args[0], true)) { Account account = Common.getInstance().getAccountManager().getAccount(args[0], true); if (account.getAccountACL().isOwner(sender) || Common.getInstance() .getServerCaller() .getPlayerCaller() .checkPermission(sender, "craftconomy.bank.delete.admin")) { Account owner = Common.getInstance().getAccountManager().getAccount(sender, false); for (Balance balance : account.getAllBalance()) { owner.deposit( balance.getBalance(), balance.getWorld(), balance.getCurrency().getName(), Cause.BANK_DELETE, args[0]); } Common.getInstance().getAccountManager().delete(args[0], true); Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().getLanguageManager().getString("bank_account_deleted")); } else { Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().getLanguageManager().getString("bank_delete_not_owner")); } } else { Common.getInstance() .getServerCaller() .getPlayerCaller() .sendMessage( sender, Common.getInstance().getLanguageManager().getString("account_not_exist")); } }
public static Map<String, String> getAllBalances(String accountStr) { String worldDef = Bukkit.getWorlds().get(0).getName(); Map<String, String> balances = new HashMap<String, String>(); if (accountStr.isEmpty()) return balances; Account account = getAccount(accountStr); if (account == null) return balances; for (Balance balance : account.getAllBalance()) { String key = "money." + (balance.getWorld().equalsIgnoreCase(worldDef) ? "" : balance.getWorld() + ".") + balance.getCurrency().getName(); String amount = craftconomy.format(balance.getWorld(), balance.getCurrency(), balance.getBalance()); balances.put(key, amount); if (balance.getWorld().equals(worldDef) && balance.getCurrency().equals(craftconomy.getCurrencyManager().getDefaultCurrency())) balances.put("money", amount); } return balances; }