mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-19 06:58:17 +00:00
Limit buy signs amount to a full inventory of a player.
This commit is contained in:
parent
32bbe877aa
commit
246383804a
1 changed files with 1 additions and 1 deletions
|
@ -28,8 +28,8 @@ public class SignBuy extends EssentialsSign
|
||||||
@Override
|
@Override
|
||||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
|
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 ItemStack item = getItemStack(sign.getLine(2));
|
||||||
|
final int amount = Math.min(getInteger(sign.getLine(1)), item.getType().getMaxStackSize()*player.getInventory().getSize());
|
||||||
item.setAmount(amount);
|
item.setAmount(amount);
|
||||||
final Charge charge = getCharge(sign, 3, ess);
|
final Charge charge = getCharge(sign, 3, ess);
|
||||||
charge.isAffordableFor(player);
|
charge.isAffordableFor(player);
|
||||||
|
|
Loading…
Reference in a new issue