1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Bukkit Bug FurnaceExtractEvent and Shift-Clicking

Discussion in 'Bugs & Feature Requests' started by Rocoty, Feb 11, 2013.

Thread Status:
Not open for further replies.
  1. Hello,
    Let me just jump right into it. As a plugin developer for Bukkit I naturally want a bugfree coding environment, but ran into a bug lately:

    When a FurnaceExtractEvent is passed, it should contain information about the item, and how many instances of that item, that was extracted from the furnace. And it does this flawlessly when dragging and dropping the items from the furnace.

    However, when shift-clicking the item to add it directly to the inventory, the event does properly return the item type, but the amount is always 0. What's more is that it passes the event twice when shift-clicking.

    I find this to be a bug which slows down the development of my plugin greatly, and if this could be fixed, I would be forever grateful.

    new​
    Rocoty()​
     
  2. Anyone? Or even a workaround?
     
  3. md_5

    Administrator Developer

    I've been really busy lately, if you make a fix, or know someone who will, let me know and I can put it in Spigot.
     
  4. I believe I could fix it. But I don't have the faintest idea where the events are called.
     
  5. prplz

    Supporter

  6. You can use the inventoryClickEvent :
    Code (Text):

    public static int getAmountFurnaceExtractAmount(Material m, InventoryClickEvent e)
        {
            Inventory clickedInventory = e.getClickedInventory();
            if(!clickedInventory.getType().equals(InventoryType.FURNACE))
                return 0;
            FurnaceInventory fi = (FurnaceInventory) clickedInventory;
            boolean click = e.getClick().isShiftClick() || e.getClick().isLeftClick() && e.getRawSlot() == 2;
            boolean item = fi.getResult() != null && fi.getResult().getType().equals(m);
            if(click && item)
                return fi.getResult().getAmount();
            return 0;
        }
     
    Sorry for this late post but if member want the solution ^^ ;)
     
Thread Status:
Not open for further replies.