Skip to content

Commit

Permalink
Implement getBalances
Browse files Browse the repository at this point in the history
  • Loading branch information
ericgrandt committed Aug 5, 2017
1 parent b4fd7cc commit 988c295
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/main/java/com/erigitic/config/TEAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,21 @@ public BigDecimal getBalance(Currency currency, Set<Context> contexts) {
return BigDecimal.ZERO;
}

/**
* Get a player's balance for each currency type
*
* @param contexts
* @return Map A map of the balances of each currency
*/
@Override
public Map<Currency, BigDecimal> getBalances(Set<Context> contexts) {
return new HashMap<>();
HashMap<Currency, BigDecimal> balances = new HashMap<>();

for (Currency currency : totalEconomy.getCurrencies()) {
balances.put(currency, getBalance(currency, contexts));
}

return balances;
}

/**
Expand All @@ -163,7 +175,7 @@ public Map<Currency, BigDecimal> getBalances(Set<Context> contexts) {
* @param amount Amount to set the balance to
* @param cause
* @param contexts
* @return
* @return TransactionResult Result of the transaction
*/
@Override
public TransactionResult setBalance(Currency currency, BigDecimal amount, Cause cause, Set<Context> contexts) {
Expand Down

0 comments on commit 988c295

Please sign in to comment.