Skip to content

Let players use their own inventory while a panel is open - #3100

Merged
tastybento merged 1 commit into
developfrom
fix/panel-player-inventory-clicks
Oct 10, 2026
Merged

tastybento merged 1 commit into
developfrom
fix/panel-player-inventory-clicks

Conversation

@tastybento

@tastybento tastybento commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

Brings back the goal of #2767 (moving items, dropping them and using bundles in your own inventory while a BentoBox panel is open) without the regressions that got it reverted in 3.11.1 (#2776: icon pickers broke, and shift-clicks or drags could move items into panels, where they were lost).

How

  • A click in the player's own inventory is left to vanilla only if its InventoryAction can't put an item into the panel: pickup, place, swap with cursor, hotbar/offhand swap, drop (Q / Ctrl+Q) and the bundle actions. Shift-click (MOVE_TO_OTHER_INVENTORY) and double-click (COLLECT_TO_CURSOR) stay blocked.
  • Opt-in for panels with a listener. The new PanelListener#allowsPlayerInventoryClicks() defaults to false, so panels that read inventory clicks (the core IconChanger, and the Challenges and Biomes edit panels) see them exactly as before. TabbedPanel and AbstractRefreshingPanel (settings, command ranks) opt in. Panels without a listener can't read these clicks, so they always allow them.
  • A click on a panel slot stays cancelled while the cursor holds an item, even if the click handler returns false.
  • New InventoryDragEvent handler cancels drags that touch any panel slot.

API

PanelListener#allowsPlayerInventoryClicks() is a new default method, so it's binary compatible. It's tagged @since 3.23.4.

Testing

  • 7 new tests in PanelListenerManagerTest; the full suite passes (3,597 tests).
  • Tested by hand on a Paper 26.3 server: /is settings, /bsbadmin settings and /bentobox manage (inventory moves, drops, bundles, blocked shift-click/double-click/drag, no item loss on close) and the icon pickers in /bsbadmin blueprint and /bsbadmin challenges. Everything worked.

Refs #2767, #2776

#2767 tried this by only cancelling clicks in the panel itself, but that
stopped icon pickers seeing clicks in the player's inventory (#2776) and
let shift-clicks and drags move items into panels, where they were lost.
It was reverted in 3.11.1.

This version keeps routing player-inventory clicks to the panel and only
lets them through when:
- the action cannot move an item into the panel (pickup, place, swap,
  hotbar swap, drop, bundles; not shift-click or double-click), and
- the panel has no listener, or its listener opts in via the new
  PanelListener#allowsPlayerInventoryClicks() (default false, so addon
  icon pickers are unaffected). TabbedPanel and AbstractRefreshingPanel
  opt in.

A held item can never be placed in a panel, even if a click handler
uncancels the click, and drags that touch panel slots are cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tastybento
tastybento merged commit 369c23d into develop Oct 10, 2026
1 check passed
@tastybento
tastybento deleted the fix/panel-player-inventory-clicks branch October 10, 2026 00:23
@sonarqubecloud

Copy link
Copy Markdown

@tastybento tastybento mentioned this pull request Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant