Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /t & /n deposit all #6081

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/com/palmergames/bukkit/towny/command/NationCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2572,11 +2572,10 @@ private static void nationTransaction(Player player, String[] args, boolean with
throw new TownyException(Translatable.of("msg_must_specify_amnt", "/nation" + (withdraw ? " withdraw" : " deposit")));

int amount;
try {
amount = Integer.parseInt(args[1].trim());
} catch (NumberFormatException ex) {
throw new TownyException(Translatable.of("msg_error_must_be_int"));
}
if ("all".equalsIgnoreCase(args[1].trim()))
amount = (int) Math.floor(withdraw ? nation.getAccount().getHoldingBalance() : resident.getAccount().getHoldingBalance());
else
amount = MathUtil.getIntOrThrow(args[1].trim());

if (args.length == 2) {
if (withdraw)
Expand Down
6 changes: 5 additions & 1 deletion src/com/palmergames/bukkit/towny/command/TownCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4150,7 +4150,11 @@ private static void townTransaction(Player player, String[] args, boolean withdr
throw new TownyException(Translatable.of("msg_err_dont_belong_town"));

if (args.length == 2) {
int amount = MathUtil.getIntOrThrow(args[1].trim());
int amount;
if ("all".equalsIgnoreCase(args[1].trim()))
amount = (int) Math.floor(withdraw ? resident.getTown().getAccount().getHoldingBalance() : resident.getAccount().getHoldingBalance());
else
amount = MathUtil.getIntOrThrow(args[1].trim());

if (withdraw)
MoneyUtil.townWithdraw(player, resident, resident.getTown(), amount);
Expand Down