Skip to content

fix(refresh): mark items so DupeFixer can catch them#280

Merged
BlitzOffline merged 1 commit into
HelpChat:mainfrom
Gqtien:fix/refresh-mark-items
May 14, 2026
Merged

fix(refresh): mark items so DupeFixer can catch them#280
BlitzOffline merged 1 commit into
HelpChat:mainfrom
Gqtien:fix/refresh-mark-items

Conversation

@Gqtien
Copy link
Copy Markdown
Contributor

@Gqtien Gqtien commented May 14, 2026

Menu#openMenu stamps every ItemStack with MenuItemMarker#mark before placing it in the inventory, so DupeFixer.onPickup / onDrop and Menu#cleanInventory can recognize and remove a DeluxeMenus item that ever escapes the menu. MenuHolder#refreshMenu rebuilds the same stacks but skips that call. Any item served after a refresh ([refresh] action, refresh_interval, periodic update task) slips past the dupe fixer.

Fix

Mirror the null-check + mark pattern already used in Menu#openMenu:

                 for (MenuItem item : active) {

                     ItemStack iStack = item.getItemStack(this);

+                    if (iStack == null) {
+                        continue;
+                    }
+
+                    iStack = plugin.getMenuItemMarker().mark(iStack);

                     int slot = item.options().slot();

Demonstration

dm.mp4

A companion plugin rewrites each menu item's lore every tick with its live PDC keys, so the marker state is observable in-game without dumping NBT.

Menu config:

menu_title: '&8Refresh sanitizes PDC'
open_command: demo
size: 27

items:
  diamond:
    material: DIAMOND
    slot: 13
    left_click_commands:
    - '[refresh]'
    right_click_commands:
    - '[openmenu] demo'

On /demo, the diamond's lore reads deluxemenus:dm.

  • Without this patch: left-click flips the lore to (no PDC keys). Right-click ([openmenu]) restores it, since Menu#openMenu already marks correctly.
  • With this patch: the lore stays on deluxemenus:dm across any number of refreshes.

@BlitzOffline BlitzOffline merged commit 6fb069d into HelpChat:main May 14, 2026
2 checks passed
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.

2 participants