Wraps a ResultSet in an Iterator. This is useful when you want to present a non-database application layer with domain neutral data.
ResultSet
Iterator
This implementation requires the ResultSet.isLast() method to be implemented.
ResultSet.isLast()
3738394041424344454647
} } } else if(Bukkit.getPluginManager().getPlugin("iConomy") instanceof iConomy) { iConomyEcon = new Accounts(); if(iConomyEcon != null) Bukkit.getLogger().fine("iConomy detected and connected, economy available."); }
23242526272829
} @Override public double getBalance(String playerName) { this.checkExist(playerName); return new Accounts().get(playerName).getHoldings().getBalance(); }
3940414243444546
} @Override public boolean add(String playerName, double amount) { this.checkExist(playerName); new Accounts().get(playerName).getHoldings().add(amount); return true; }
47484950515253545556
@Override public boolean subtract(String playerName, double amount) { this.checkExist(playerName); if (this.canAfford(playerName, amount)) { new Accounts().get(playerName).getHoldings().subtract(amount); return true; } return false; }
585960616263646566676869
@Override public boolean transfer(String playerFrom, String playerTo, double amount) { this.checkExist(playerTo); this.checkExist(playerFrom); if (this.canAfford(playerFrom, amount)) { Account p1 = new Accounts().get(playerFrom); Account p2 = new Accounts().get(playerTo); p1.getHoldings().subtract(amount); p2.getHoldings().add(amount); return true; } return false;
68697071727374757677
} return false; } private void checkExist(String playerName) { Accounts acc = new Accounts(); if (!acc.exists(playerName)) { acc.create(playerName); } }
35363738394041
public iConomy6Balance (ShowCaseStandalone scs, iConomy iconomy) { // super (scs); this.iconomy = iconomy; this.scs = scs; accounts = new Accounts (); }
47484950515253
public boolean hasBank(String bank) { return false; } public boolean hasAccount(String name) { return (new Accounts()).exists(name); }
58596061626364
public boolean createAccount(String name) { if(hasAccount(name)) return false; return (new Accounts()).create(name); }
65666768697071
public boolean createAccount(String name, double balance) { if(hasAccount(name)) return false; return (new Accounts()).create(name, balance); }