From eccc2f2fb0fbb15f92888f1beff72eb74bcceea5 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 1 Feb 2015 08:04:19 +1300 Subject: [PATCH] Fixed bug with dropping gadget items interfering with games and being set in the wrong slot with the wrong name --- .../src/mineplex/core/gadget/types/ItemGadget.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java index 6683c9a3c..9c2387dab 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/types/ItemGadget.java @@ -80,19 +80,21 @@ public abstract class ItemGadget extends Gadget } @EventHandler - public void orderThatChest(final PlayerDropItemEvent event) + public void orderThatChest(PlayerDropItemEvent event) { - if (event.getItemDrop().getItemStack().getType() == GetDisplayMaterial()) + if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial()) { + final Player player = event.getPlayer(); + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() { public void run() { - if (event.getPlayer().isOnline()) + if (player.isOnline()) { - event.getPlayer().getInventory().remove(GetDisplayMaterial()); - event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(GetName()))); - UtilInv.Update(event.getPlayer()); + player.getInventory().remove(GetDisplayMaterial()); + player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(GetDisplayMaterial(), GetDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName()))); + UtilInv.Update(player); } } });