From 599c47a8c21ea832ccf0cf4014414161ff19cc3b Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Fri, 5 Aug 2016 14:33:21 -0400 Subject: [PATCH] Prevent stacks of runes being consumed on one item --- .../mineplex/game/clans/items/runes/RuneManager.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/runes/RuneManager.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/runes/RuneManager.java index 1fa2eeff7..3578d5779 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/runes/RuneManager.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/runes/RuneManager.java @@ -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();