Issue with InventoryClickEvent

Discussion in 'Spigot Plugin Development' started by bman7842, Jul 13, 2015.

  1. I'm having an issue with my plugin that is designed to make all furnaces have a faster smelting speed. The problem is that inventoryclickevent does not like working properly in the furnace GUI for some weird reason. Maybe you guys have a suggestion? My code is here: https://github.com/bman7842/furnacesmelt . The event is called when I click the inventory at any spot except for the top left smelting slot in the furnace GUI.
     
  2. InventoryDragEvent maybe?
     
  3. I'll try it.
     
  4. Tried the event and it works but just is not efficient compared to InventoryClickEvent. It would not register all the time and I need it to update every time someone clicks.

    (Yes, all events are registered properly)

    Code:
    Code (Text):
        @EventHandler
        public void onInventoryInteract(InventoryDragEvent event) {
            Player p = (Player)event.getWhoClicked();
            Block blockType = event.getWhoClicked().getTargetBlock((Set<Material>) null, 10);

            Bukkit.getLogger().info("draggg");
            if (event.getInventory().getType().equals(InventoryType.FURNACE)) {
                Furnace furnace = (Furnace) blockType.getState();
                if (furnace.getCookTime() < cookTime) {
                    furnace.setCookTime(cookTime);
                    furnace.update(true);
                }
            }
        }
     
  5. Do you think that the InventoryClickEvent issue could be related to Spigot, not my own code?
     
  6. I'm using inventory click event right now... no errors in firing the event, might just want to check if you have the correct inventory your checking for and/or the correct item, i would recommend sending the player a message when the event is fired, when they pick up the item and/or when they drop the item into the furnace to check 1. if the event is firing, 2. if you got the right item and 3. if you have chosen the correct names for furnaces... it really helps trust me
     
  7. Have you even read this thread? The event works but seems to not be getting called whenever you interact specifically with the top left to be burned slot of a furnace inventory GUI. Please read the entire post before offering suggestions, thank you.
     
  8. InventoryClickEvent = When someone clicks an item in an inventory (or empty space)
    InventoryDragEvent = When someone moves an item in an inventory (drags)
     
  9. When I tested it *shown above* it did not work every time I dragged an item.
     
  10. i did :/ that was my just woke up can clearly see that you said it doesn't want to work with the furnace GUI, please don't be so negative, sometimes people make mistakes... we are not perfect xD
     
    • Agree Agree x 1
  11. Sorry, I just assumed that you were another user who thinks they know Java and is wasting my time on forum posts.
     
  12. ahhh... nope i only try to answer the ones i know, i don't like to try and answer and fail miserably... (like i just did oops :/ )
     
  13. Haha yeah it's fine, I just experience it to much on here unfortunately.
     
  14. Do you think the issue with it not working might be an event priority issue?