[BUILDTOOLS-255] InventoryCloseEvent firing when item in hand Created: 07/Jul/16  Updated: 11/Dec/17  Resolved: 08/Jul/16

Status: Resolved
Project: BuildTools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Laura Green Assignee: Unassigned
Resolution: Done Votes: 0
Labels: Bug, Inventory, InventoryCloseEvent, ItemInHand, Menu

Plugin: Custom plugin

 Description   

I just found that for some reason when opening a Bukkit inventory on the new update (1.10), latest Spigot with an item in hand, it fires the "InventoryCloseEvent", even though the menu wasn't closed.

Example 1:

  • Right click cauldron (Nothing in hand, null)
  • Creates inventory
  • Opens Bukkit Inventory/Menu
  • Player can interact with the menu, click items and change settings.

Example 2: (Bug)

  • Right click cauldron (With anything in hand)
  • Creates inventory
  • Opens Bukkit Inventory/Menu
  • InventoryCloseEvent triggered
  • When player interacts with anything, error with inventory being "null"

In my plugin I used the "InventoryCloseEvent" as a way to remove an inventory I've created and placed on a HashMap. Removing it was done for memory reasons. So whats happening for some reason is the InventoryCloseEvent is triggering without me even closing the menu, which leads it to be deleted upon the HashMap, which then leads to the null when InventoryClickEvent is fired.



 Comments   
Comment by Laura Green [ 08/Jul/16 ]

As stated above, I've found what I was doing wrong, completely forgot about the 2nd hand. I've been making plugins for so long without having to factor that in, just gotta get use to it. Sorry my bad ;p

Comment by Laura Green [ 07/Jul/16 ]

This might actually be due to the new offhand feature, so it might be just my mistake

Comment by Laura Green [ 07/Jul/16 ]

Looked into it a bit more, and it seems that the "PlayerInteractEvent" is triggering twice.

Generated at Sat Dec 13 14:34:54 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.