public static boolean creditAccount( String accountTo, String accountFrom, double amount, String currencyName, String worldName) { if (!enabled) return false; if (accountTo.isEmpty()) return false; Account account = getAccount(accountTo); if (account == null) return false; Currency currency = craftconomy.getCurrencyManager().getCurrency(currencyName); if (currency == null) currency = craftconomy.getCurrencyManager().getDefaultCurrency(); String world = getWorldName(worldName); if (!accountFrom.isEmpty() && !withdrawAccount(accountFrom, amount, currency.getName(), world)) return false; account.deposit(amount, world, currency.getName(), Cause.PLUGIN, null); return true; }
@Override public EconomyResponse depositPlayer(String playerName, double amount) { if (amount < 0) { return new EconomyResponse( 0, getBalance(playerName), ResponseType.FAILURE, "Cannot desposit negative funds"); } Account account = Common.getInstance().getAccountManager().getAccount(playerName); double balance = account.deposit( amount, Common.getInstance().getServerCaller().getDefaultWorld(), Common.getInstance().getCurrencyManager().getDefaultCurrency().getName()); return new EconomyResponse(amount, balance, ResponseType.SUCCESS, null); }
@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")); } }