Skip to content

Commit

Permalink
Use economy executor for new command
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr committed Oct 23, 2024
1 parent bbf6da7 commit e5c01dd
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2965,20 +2965,24 @@ private void parseAdminEcoInfoCommand(CommandSender sender, String[] args) throw
HelpMenu.TA_ECO_INFO.send(sender);
return;
}

Account account = switch (args[0].toLowerCase(Locale.ROOT)) {
case "serveraccount" -> TownyServerAccount.ACCOUNT;
case "nation" -> getNationOrThrow(args[1]).getAccount();
case "resident" -> getResidentOrThrow(args[1]).getAccount();
case "town" -> getTownOrThrow(args[1]).getAccount();
default -> null;
case "serveraccount" -> TownyServerAccount.ACCOUNT;
case "nation" -> getNationOrThrow(args[1]).getAccount();
case "resident" -> getResidentOrThrow(args[1]).getAccount();
case "town" -> getTownOrThrow(args[1]).getAccount();
default -> null;
};

if (account == null)
throw new TownyException("Account not found.");

TownyMessaging.sendMessage(sender, ChatTools.formatTitle("Account Info"));
TownyMessaging.sendMessage(sender, "Name: " + account.getName());
TownyMessaging.sendMessage(sender, "UUID: " + account.getUUID());
TownyMessaging.sendMessage(sender, "Balance: " + account.getHoldingBalance());
TownyEconomyHandler.economyExecutor().execute(() -> {
TownyMessaging.sendMessage(sender, ChatTools.formatTitle("Account Info"));
TownyMessaging.sendMessage(sender, "Name: " + account.getName());
TownyMessaging.sendMessage(sender, "UUID: " + account.getUUID());
TownyMessaging.sendMessage(sender, "Balance: " + account.getHoldingBalance());
});
}

private void parseAdminInstall(CommandSender sender) throws NoPermissionException {
Expand Down

0 comments on commit e5c01dd

Please sign in to comment.