1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-09 08:06:54 +02:00

Fix for money exploit on trade signs

This commit is contained in:
snowleo
2011-07-27 01:00:47 +02:00
parent b4487b5a13
commit f1efe2e1d2

View File

@@ -98,9 +98,14 @@ public class SignTrade extends EssentialsSign
if (split.length == 2 && amountNeeded) if (split.length == 2 && amountNeeded)
{ {
final Double money = getMoney(split[0]); final Double money = getMoney(split[0]);
final Double amount = getDoublePositive(split[1]); Double amount = getDoublePositive(split[1]);
if (money != null && amount != null) 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)); sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1));
return; return;
} }