Repository navigation
Give the inventory back when a clear-inventory menu opens an inventory without holder - #276
Merged
Maxlego08 merged 1 commit intoNov 12, 2026
Conversation
…ory without holder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A menu with
clear-inventory: true(DEFAULTmode) never gives the player's inventory back when one of its buttons opens an inventory that has no holder, for example an InvUI window opened by aplayer-command:Result: once the other inventory is open, and after it is closed, the player still has the
player-inventorybuttons as real items, and their own items are gone. They only come back when the player reconnects (forceGiveInventory) or opens and closes anotherclear-inventorymenu.Cause
ZInventory#closeInventorywaits one tick, then only cleans up when the new top inventory is not a zMenu one:Inventories created without holder return
nullhere: InvUI windows (their Bukkit view is built onnew CraftInventory(new SimpleContainer(0))), and anyBukkit.createInventory(null, ...). Theplayer-inventorybuttons are therefore not cleared and the saved inventory is not given back. The close actions just below already treat anullholder as "not a zMenu inventory".Fix
The condition is now
!isInNewzMenuInventory, so every inventory that is not a zMenu menu (with or without holder) clears the buttons and gives the saved inventory back, as when the menu is closed normally.Tests
The plugin builds and the
Test:v26_1_2suite passes. Not tested in game yet: we hit the bug on our server (Paper 26.1.2, InvUI 2 windows opened from aclear-inventorymenu) and will test the jar there.🤖 Generated with Claude Code