Skip to content

feat(paper): improve menu type persistent view example - #816

Open
spa77k wants to merge 1 commit into
PaperMC:mainfrom
spa77k:improve-menu-type-example
Open

spa77k wants to merge 1 commit into
PaperMC:mainfrom
spa77k:improve-menu-type-example

Conversation

@spa77k

@spa77k spa77k commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Closes #800.

Updates the persistent view example in the Menu Type API page:

  • Store the views keyed by the player's UUID instead of the Player object, and look them up with getUniqueId() in the command and quit handler.
  • Add an InventoryClickEvent handler that checks event.getView() against the stored view, as an example of identifying which menu a player is interacting with. It stops shulker boxes from being put into the stash by placing from the cursor, swapping with the cursor, shift-clicking, or using the number/offhand keys (getHotbarButton() is -1 for the offhand swap).
  • Add a note that dragging items fires InventoryDragEvent instead, which has to be handled separately.

Verification:

  • Checked each InventoryAction that can move an item into the top inventory against the Paper Javadoc.
  • git diff --check passed.

Use player UUIDs instead of Player objects as map keys and add an
InventoryClickEvent example that identifies the stash view.
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
papermc-docs ✅ Ready (View Log) Visit Preview 49558e7

This branch was successfully deployed

1 active deployment
Preview — 49558e79 Deployed Oct 21, 2026 by github-actions[bot]
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.

Improve Menu Type example

1 participant