@Override public double getBalance(String player) { Account account = eco.getBank().getAccount(player); if (account == null) { eco.getBank().addAccount(player); account = eco.getBank().getAccount(player); } return account.getBalance(); }
@Override public boolean deposit(String player, double amount) { if (amount > 0) { Account account = eco.getBank().getAccount(player); if (account == null) { eco.getBank().addAccount(player); account = eco.getBank().getAccount(player); } account.add(amount); return true; } return false; }
private void hookDepends() { Plugin test = getServer().getPluginManager().getPlugin("iConomy"); if (test != null) { // this.getServer().getPluginManager().isPluginEnabled("iConomy")) { iConomy = (iConomy) test; // this.getServer().getPluginManager().getPlugin("iConomy"); iBank = iConomy.getBank(); // config.currency = iBank.getCurrency(); Log("Attached to iConomy."); } else { test = getServer().getPluginManager().getPlugin("BOSEconomy"); if (test != null) { economy = (BOSEconomy) test; Log("Attached to BOSEconomy"); } else { Log(Level.WARNING, "economy plugin not yet found...", false); } } test = getServer().getPluginManager().getPlugin("Permissions"); if (test != null) { // this.getServer().getPluginManager().isPluginEnabled("Permissions")) { Permissions = (Permissions) test; // this.getServer().getPluginManager().getPlugin("Permissions"); Log("Attached to Permissions."); } test = getServer().getPluginManager().getPlugin("MinecraftIM"); if (test != null) { // this.getServer().getPluginManager().isPluginEnabled("MinecraftIM")) { messenger = (MinecraftIM) test; // this.getServer().getPluginManager().getPlugin("MinecraftIM"); Log("linked to MinecraftIM"); } // Log(Level.INFO, "Permissions not yet found..."); }
@Override public boolean withdraw(String player, double amount) { if (amount > 0) { Account account = eco.getBank().getAccount(player); if (account == null) { eco.getBank().addAccount(player); account = eco.getBank().getAccount(player); } double balance = account.getBalance(); if ((balance - amount) >= 0) { account.subtract(amount); return true; } } return false; }
public Method.MethodAccount getAccount(String name) { return new iCoAccount(iConomy.getBank().getAccount(name)); }
public boolean hasAccount(String name) { return iConomy.getBank().hasAccount(name); }
public String format(double amount) { return iConomy.getBank().format(amount); }