Prevent GUI placeholder items from being taken from open menus #1

Merged
NotAlexNoyle merged 1 commits from codex/fix-removal-of-black-stained-glass-panes into master 2026-03-09 05:19:44 -04:00
NotAlexNoyle commented 2026-03-09 05:19:35 -04:00 (Migrated from github.com)

Motivation

  • GUI placeholder items (e.g. stained-glass panes) could be picked up or moved by players from open menus, allowing removal of GUI decorations and unexpected interactions.
  • Click handling could bleed across inventories when this GUI was not the top open inventory, causing incorrect processing of player clicks.

Description

  • Updated playerInventoryClickHandler to check the view's top inventory via event.getView().getTopInventory() and return early unless it matches this GUI's inventory.
  • Cancelled all clicks that target the GUI area (event.getRawSlot() < topInventory.getSize()), preventing placeholder panes and other GUI items from being taken or moved.
  • Kept GUI click behavior for configured GUIItem entries by executing guiItem.executeClick(clickType) when appropriate and still playing configured error sounds for invalid interactions.
  • Cancelled shift-quick-move attempts from the player inventory while this GUI is open to stop items being transferred into GUI slots.

Testing

  • Ran ./gradlew test, which could not complete in this environment due to a Java version parsing error (IllegalArgumentException: 25.0.1) that occurs before project tests execute, so automated tests did not run to completion.

Codex Task

### Motivation - GUI placeholder items (e.g. stained-glass panes) could be picked up or moved by players from open menus, allowing removal of GUI decorations and unexpected interactions. - Click handling could bleed across inventories when this GUI was not the top open inventory, causing incorrect processing of player clicks. ### Description - Updated `playerInventoryClickHandler` to check the view's top inventory via `event.getView().getTopInventory()` and return early unless it matches this GUI's `inventory`. - Cancelled all clicks that target the GUI area (`event.getRawSlot() < topInventory.getSize()`), preventing placeholder panes and other GUI items from being taken or moved. - Kept GUI click behavior for configured `GUIItem` entries by executing `guiItem.executeClick(clickType)` when appropriate and still playing configured error sounds for invalid interactions. - Cancelled `shift`-quick-move attempts from the player inventory while this GUI is open to stop items being transferred into GUI slots. ### Testing - Ran `./gradlew test`, which could not complete in this environment due to a Java version parsing error (`IllegalArgumentException: 25.0.1`) that occurs before project tests execute, so automated tests did not run to completion. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69ae8fd65984832fa93e029bc0bf5016)
Sign in to join this conversation.