@Override public double get(String name) { Member member = memberManager.getMemberByName(name); Kingdom kingdom = kingdomManager.getKingdomByName(name); if (member != null) { return member.getMoney(); } if (kingdom != null) { return kingdom.getMoney(); } return 0; }
@Override public boolean has(String name, double v) { Member member = memberManager.getMemberByName(name); Kingdom kingdom = kingdomManager.getKingdomByName(name); if (member != null) { if (member.getMoney() >= v) { return true; } } if (kingdom != null) { if (kingdom.getMoney() >= v) { return true; } } return false; }