Skip to content

Commit

Permalink
Updated config defaults
Browse files Browse the repository at this point in the history
Added check for command length on resident savings as was throwing a console error when no args supplied
  • Loading branch information
tomhmagic committed Sep 7, 2023
1 parent f0998d1 commit 8a72d0b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,35 @@ public boolean onCommand(CommandSender commandSender, Command command, String s,
assert res != null;
if (res.hasPermissionNode("townypay.command.resident.savings")) {

String arg = strings[0];
int amount;

switch (arg) {
case "info":
sendSavingsInfo(commandSender, res);
break;
case "deposit":
if (!GeneralUtil.isNotInteger(strings[1])) {
amount = Integer.parseInt(strings[1]);
savingsDeposit(commandSender, res, amount);
} else {
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.general.ValueError"));
}
break;
case "withdraw":
if (!GeneralUtil.isNotInteger(strings[1])) {
amount = Integer.parseInt(strings[1]);
savingsWithdraw(commandSender, res, amount);
} else {
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.general.ValueError"));
}
break;
default:
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.resident.CommandFail.savings"));
int amount;
if (strings.length !=0) {
String arg = strings[0];
switch (arg) {
case "info":
sendSavingsInfo(commandSender, res);
break;
case "deposit":
if (!GeneralUtil.isNotInteger(strings[1])) {
amount = Integer.parseInt(strings[1]);
savingsDeposit(commandSender, res, amount);
} else {
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.general.ValueError"));
}
break;
case "withdraw":
if (!GeneralUtil.isNotInteger(strings[1])) {
amount = Integer.parseInt(strings[1]);
savingsWithdraw(commandSender, res, amount);
} else {
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.general.ValueError"));
}
break;
default:
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.resident.CommandFail.savings"));
}
} else {
MessageUtil.sendErrorMsg(commandSender, Translatable.of("townypay.resident.CommandFail.savings"));
}
}else{
//no perms
Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TownSettings:
#Profit setting for towns, profit is worked out as
#(Current balance - (ProfitCalc * upkeep))
Profit:
Multiplier: 2.0
Multiplier: 5.0

MayorPay:
#Enable Mayor Pay, Disable if you just want the budget system
Expand All @@ -25,23 +25,23 @@ TownSettings:
PayFixedAmount: false
#Value is percentage of profit paid to mayor or fixed amount if PayFixedAmount=true, Min and Max only needed if CanSet=true
Pay:
Value: 20
Value: 10
Min: 5
Max: 30
#Percentage of tax to take from the pay, if FixedAmount=true then tax is fixed amount and cannot be higher than Pay.Value
Tax: 20.0
#Minimum balance before the system will pay a Mayor, if using FixedAmount, set this no less than Pay.Value
#if FixedAmount is false, then it will use the profit to calculate Mayors pay
MinimumBal: 0.0
MinimumBal: 100.0

BudgetSettings:
#If true, Budget would be a fixed amount
FixedBudget: false
#Percentage of profit, fixed amount if FixedBudget=true
Budget: 10.0
Budget: 25.0
#If FixedBudget false, set an amount for a minimum balance for the percentage calculations to return a budget.
#Must be higher than 0.0
MinimumBal: 1.0
MinimumBal: 100.0

#Tax percentage to be taken from the payee
Tax:
Expand Down Expand Up @@ -73,23 +73,23 @@ NationSettings:
PayFixedAmount: false
#Value is percentage of profit paid to king or fixed amount if PayFixedAmount=true, Min and Max only needed if CanSet=true
Pay:
Value: 20
Value: 10
Min: 5
Max: 30
#Percentage of tax to take from the pay, if FixedAmount=true then tax is fixed amount and cannot be higher than Pay.Value
Tax: 20.0
#Minimum balance before the system will pay a King, if using FixedAmount, set this no less than Pay.Value
#if FixedAmount is false, then it will use the profit to calculate Kings pay
MinimumBal: 0.0
MinimumBal: 100.0

BudgetSettings:
#If true, Budget would be a fixed amount
FixedBudget: false
#Percentage of profit, fixed amount if FixedBudget=true
Budget: 10.0
Budget: 25.0
#If FixedBudget false, set an amount for a minimum balance for the percentage calculations to return a budget.
#Must be higher than 0.0
MinimumBal: 1.0
MinimumBal: 100.0

#Tax percentage to be taken from the payee
Tax:
Expand Down Expand Up @@ -148,7 +148,7 @@ SavingsSettings:
Maximum: 500000
#Percent interest rates for each threshold, if town does not meet threshold then BaseInterest will be used
Rates:
Minimal: 0.5
Minimal: 0.6
Low: 0.75
Moderate: 1.0
High: 1.5
Expand Down

0 comments on commit 8a72d0b

Please sign in to comment.