1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-14 02:24:16 +02:00

Limit buy signs amount to a full inventory of a player.

This commit is contained in:
snowleo
2011-06-12 22:40:25 +02:00
parent 0c4d4688f0
commit 80055bb63f

View File

@@ -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);