Skip to content

Commit 853a3b4

Browse files
committed
feat: add ‘short’ formatting for placeholders
1 parent f877b3f commit 853a3b4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/pro/cloudnode/smp/bankaccounts/integrations/PAPIIntegration.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ yield switch (args[1]) {
5151
);
5252
yield null;
5353
}
54+
case "short" -> {
55+
if (args.length == 3)
56+
yield Account.get(Account.Tag.from(args[2])).map(value -> BankAccounts.formatCurrencyShort(value.balance)).orElse(null);
57+
if (args.length == 2)
58+
yield BankAccounts.formatCurrencyShort(
59+
Arrays.stream(Account.get(player))
60+
.map(account -> account.balance)
61+
.reduce(BigDecimal.ZERO, BigDecimal::add)
62+
);
63+
yield null;
64+
}
5465
default -> Account.get(Account.Tag.from(args[1])).map(value -> String.valueOf(value.balance)).orElse(null);
5566
};
5667
}

0 commit comments

Comments
 (0)