Fix bank not accepting decimals, fix ArrayIndexOutOfBoundsException

This commit is contained in:
Esophose 2019-02-22 02:49:58 -07:00
parent e997bb3770
commit 473d8c908e
2 changed files with 16 additions and 2 deletions

View File

@ -72,7 +72,13 @@ public class BankCommand extends SubCommand {
"%balance%", String.valueOf(balance)));
return;
case "Deposit": {
double amt = Long.parseLong(args[1]);
if (args.length == 1) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short3.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
double amt = Double.parseDouble(args[1]);
if (!economyManager.hasBalance(player, amt)) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short.Message"));
@ -86,7 +92,13 @@ public class BankCommand extends SubCommand {
return;
}
case "Withdraw": {
double amt = Long.parseLong(args[1]);
if (args.length == 1) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short3.Message"));
soundManager.playSound(player, Sounds.ANVIL_LAND.bukkitSound(), 1.0F, 1.0F);
return;
}
double amt = Double.parseDouble(args[1]);
if (amt > balance) {
messageManager.sendMessage(player, configLoad.getString("Command.Island.Bank.Short2.Message"));

View File

@ -33,6 +33,8 @@ Command:
Message: "&bSkyBlock &8| &cError&8: &eYou don't have enough money to do that."
Short2:
Message: "&bSkyBlock &8| &cError&8: &eThere is not enough money to withdraw."
Short3:
Message: "&bSkyBlock &8| &cError&8: &eYou did not specify an amount."
Invalid:
Message: "&bSkyBlock &8| &cError&8: &eInvalid: /island bank [<Deposit|Withdraw|Balance>]"
Unlock: