Prevent stacks of runes being consumed on one item
This commit is contained in:
parent
a56f72b6af
commit
599c47a8c2
@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.game.clans.items.CustomItem;
|
||||
@ -248,8 +249,18 @@ public class RuneManager implements Listener
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
ItemStack cursorAfter = null;
|
||||
if (event.getCursor().getAmount() > 1)
|
||||
{
|
||||
cursorAfter = event.getCursor().clone();
|
||||
cursorAfter.setAmount(cursorAfter.getAmount() - 1);
|
||||
}
|
||||
event.setCursor(new ItemStack(Material.AIR));
|
||||
event.getClickedInventory().setItem(event.getSlot(), after);
|
||||
if (cursorAfter != null)
|
||||
{
|
||||
UtilInv.insert(player, cursorAfter);
|
||||
}
|
||||
player.playSound(player.getLocation(), Sound.ANVIL_USE, 1.5f, 5f);
|
||||
|
||||
player.updateInventory();
|
||||
|
Loading…
Reference in New Issue
Block a user