Give money back to sender if MaxMoneyException thrown (fixes #106)

This commit is contained in:
vemacs 2015-07-28 19:20:47 -06:00
parent 9fb0ab57e6
commit d7b0f74a75

View file

@ -43,6 +43,11 @@ public class Commandpay extends EssentialsLoopCommand {
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
} catch (MaxMoneyException ex) {
sender.sendMessage(tl("maxMoney"));
try {
user.setMoney(user.getMoney().add(amount));
} catch (MaxMoneyException ignored) {
// this should never happen
}
}
}
}