Skip to content

Commit 52a6a7e

Browse files
committed
successfully accepted account ownership message
1 parent 6485ede commit 52a6a7e

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

src/main/java/pro/cloudnode/smp/bankaccounts/BankConfig.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,25 @@ public int invoicePerPage() {
14551455
);
14561456
}
14571457

1458+
// messages.change-owner.accepted
1459+
public @NotNull Component messagesChangeOwnerAccepted(final @NotNull Account.ChangeOwnerRequest request) {
1460+
final @NotNull Account account = request.account().orElse(new Account.ClosedAccount());
1461+
final @NotNull OfflinePlayer newOwner = request.newOwner();
1462+
return MiniMessage.miniMessage().deserialize(
1463+
Objects.requireNonNull(config.getString("messages.change-owner.accepted"))
1464+
.replace("<new-owner-uuid>", newOwner.getUniqueId().toString())
1465+
.replace("<new-owner>", newOwner.getName() == null ? "<i>unknown player</i>" : newOwner.getName())
1466+
.replace("<account>", account.name())
1467+
.replace("<account-id>", account.id)
1468+
.replace("<account-type>", account.type.getName())
1469+
.replace("<account-owner>", account.ownerNameUnparsed())
1470+
.replace("<balance>", account.balance == null ? "∞" : account.balance.toPlainString())
1471+
.replace("<balance-formatted>", BankAccounts.formatCurrency(account.balance))
1472+
.replace("<balance-short>", BankAccounts.formatCurrencyShort(account.balance)),
1473+
Formatter.date("date", request.created.toInstant().atZone(ZoneOffset.UTC).toLocalDateTime())
1474+
);
1475+
}
1476+
14581477
// messages.update-available
14591478
public @NotNull Component messagesUpdateAvailable(final @NotNull String version) {
14601479
return MiniMessage.miniMessage().deserialize(

src/main/java/pro/cloudnode/smp/bankaccounts/commands/BankCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,7 @@ public static boolean acceptChangeOwner(final @NotNull CommandSender sender, fin
508508

509509
final boolean success = request.get().confirm();
510510
if (!success) return sendMessage(sender, BankAccounts.getInstance().config().messagesErrorsChangeOwnerAcceptFailed());
511-
// TODO: send success message to new owner
512-
return true;
511+
return sendMessage(sender, BankAccounts.getInstance().config().messagesChangeOwnerAccepted(request.get()));
513512
}
514513

515514
/**

src/main/resources/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,10 @@ messages:
628628
# Same placeholders as details (except <accept-command>)
629629
sent: <green>(!) You have sent a request to <gray><new-owner></gray> to become the new owner of account <gray><hover:show_text:'<white><account></white><newline><gray><account-type><dark_gray>:</dark_gray> <green><balance-formatted></green></gray><newline><gray>Owned by <account-owner></gray><newline><gray><account-id></gray>'><account></hover></gray>.</green>
630630

631+
# You have accepted an account owner change request
632+
# Same placeholders as details (except <accept-command>)
633+
accepted: <click:run_command:/bank bal <account-id>><green>(!) You are now the new owner of <gray><hover:show_text:'<white><account></white><newline><gray><account-type><dark_gray>:</dark_gray> <green><balance-formatted></green></gray><newline><gray>Owned by <account-owner></gray><newline><gray><account-id></gray>'><account></hover></gray>. Click to view account.</green></click>
634+
631635
# New version available
632636
# Placeholders:
633637
# <version> - New version

0 commit comments

Comments
 (0)