summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-06-12 22:40:25 +0200
committersnowleo <schneeleo@gmail.com>2011-06-12 22:40:25 +0200
commit246383804a1cf20a87accaa9fabb5149c84104de (patch)
tree6e2b50dcf8f058d618443054996de9f8257cc6b3
parent32bbe877aada27b6e8a71e9d3712e54707f05e8f (diff)
downloadEssentials-246383804a1cf20a87accaa9fabb5149c84104de.tar
Essentials-246383804a1cf20a87accaa9fabb5149c84104de.tar.gz
Essentials-246383804a1cf20a87accaa9fabb5149c84104de.tar.lz
Essentials-246383804a1cf20a87accaa9fabb5149c84104de.tar.xz
Essentials-246383804a1cf20a87accaa9fabb5149c84104de.zip
Limit buy signs amount to a full inventory of a player.
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBuy.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
index 24e4cbade..089faeb31 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
@@ -28,8 +28,8 @@ public class SignBuy extends EssentialsSign
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
{
- final int amount = getInteger(sign.getLine(1));
final ItemStack item = getItemStack(sign.getLine(2));
+ final int amount = Math.min(getInteger(sign.getLine(1)), item.getType().getMaxStackSize()*player.getInventory().getSize());
item.setAmount(amount);
final Charge charge = getCharge(sign, 3, ess);
charge.isAffordableFor(player);