Skip to content

Commit

Permalink
Add new message node for balo outputs that include the player's name.…
Browse files Browse the repository at this point in the history
… Messages.Money.HoldingsMultiOther
  • Loading branch information
creatorfromhell committed Oct 11, 2024
1 parent e4e1581 commit 21b7f84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Core/resources/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# All configurable messages in TNE
Messages:

config-version: 8
config-version: 9

General:
Version: "<white>TNE Version: <green>$version <white>- Build: <green>$build"
Expand Down Expand Up @@ -89,6 +89,7 @@ Messages:
Restricted: "<red>$player is unable to use the specified currency."
Insufficient: "<red>I'm sorry, but you do not have <gold>$amount<red>."
InsufficientOther: "<red>I'm sorry, but $player does not have <gold>$amount<red>."
HoldingsMultiOther: "<white>Balances for $player in world '$world' are: "
HoldingsMulti: "<white>Balances for world '$world' are: "
HoldingsMultiSingle: "<white>$currency<newline>Total: <gold>$amount<newline><white>Inventory: <gold>$inventory<newline><white>Ender Chest: <gold>$ender<newline><white>Virtual: <gold>$virtual"
Holdings: "<white>You currently have <gold>$amount<white> on you."
Expand Down
12 changes: 7 additions & 5 deletions Core/src/net/tnemc/core/command/MoneyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public static void onGiveNote(final CmdSource<?> sender, final Account acc, fina

final Optional<Account> accountOpt = BaseCommand.account(acc.getIdentifier(), "note");
final Account account = accountOpt.orElse(acc);
if(note.isPresent() && account instanceof PlayerAccount player) {
if(note.isPresent() && account instanceof final PlayerAccount player) {

final Optional<PlayerProvider> provider = player.getPlayer();

Expand Down Expand Up @@ -343,7 +343,7 @@ public static void onNote(final CmdSource<?> sender, final PercentBigDecimal amo

final Optional<Account> account = BaseCommand.account(sender, "note");
final Optional<Note> note = currency.getNote();
if(account.isPresent() && note.isPresent() && account.get() instanceof PlayerAccount player) {
if(account.isPresent() && note.isPresent() && account.get() instanceof final PlayerAccount player) {

final Optional<PlayerProvider> provider = player.getPlayer();
if(provider.isEmpty()) {
Expand Down Expand Up @@ -431,7 +431,9 @@ public static void onOther(final CmdSource<?> sender, final Account account, Str
return;
}

final MessageData msg = new MessageData("Messages.Money.HoldingsMulti");
final String header = (other)? "Messages.Money.HoldingsMultiOther" : "Messages.Money.HoldingsMulti";

final MessageData msg = new MessageData(header);
msg.addReplacement("$world", MISCUtils.worldFormatted(region));
msg.addReplacement("$player", account.getName());
sender.message(msg);
Expand Down Expand Up @@ -718,7 +720,7 @@ public static void onSetAll(final CmdSource<?> sender, final BigDecimal amount,

public static void onSwitch(final CmdSource<?> sender, final Account account) {

if(account instanceof SharedAccount shared) {
if(account instanceof final SharedAccount shared) {

if(sender.identifier().isEmpty()) {

Expand Down Expand Up @@ -975,7 +977,7 @@ public static Optional<Receipt> processTransaction(final CmdSource<?> sender, fi
}

return result.getReceipt();
} catch(InvalidTransactionException e) {
} catch(final InvalidTransactionException e) {
e.printStackTrace();
}
return Optional.empty();
Expand Down

0 comments on commit 21b7f84

Please sign in to comment.