diff options
author | snowleo <schneeleo@gmail.com> | 2011-07-27 01:00:47 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-07-27 01:00:55 +0200 |
commit | 0ac26265e21c49dc6614e3c9a289e97dad725051 (patch) | |
tree | 0259278b02c18c6f5c0e182c299bdbb895a894d3 /Essentials | |
parent | 8bb4067f061f1b2e449a670c2f7cacf3f89eda96 (diff) | |
download | Essentials-0ac26265e21c49dc6614e3c9a289e97dad725051.tar Essentials-0ac26265e21c49dc6614e3c9a289e97dad725051.tar.gz Essentials-0ac26265e21c49dc6614e3c9a289e97dad725051.tar.lz Essentials-0ac26265e21c49dc6614e3c9a289e97dad725051.tar.xz Essentials-0ac26265e21c49dc6614e3c9a289e97dad725051.zip |
Fix for money exploit on trade signs
Diffstat (limited to 'Essentials')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/signs/SignTrade.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java index 6c0205d34..d9b5f7cc2 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java @@ -98,9 +98,14 @@ public class SignTrade extends EssentialsSign if (split.length == 2 && amountNeeded) { final Double money = getMoney(split[0]); - final Double amount = getDoublePositive(split[1]); + Double amount = getDoublePositive(split[1]); if (money != null && amount != null) { + amount -= amount % money; + if (amount < 1 || money < 1) + { + throw new SignException(Util.i18n("moreThanZero")); + } sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1)); return; } |