Fixed bug with dropping gadget items interfering with games and being set in the wrong slot with the wrong name
This commit is contained in:
parent
0c2054ac32
commit
eccc2f2fb0
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user