Skip to content

Add /showworth toggle, Folia support, and creative worth-baking fix - #19

Merged
Faboit1 merged 2 commits into
mainfrom
claude/item-worth-display-bugs-1hrf2y
Aug 12, 2026
Merged

Add /showworth toggle, Folia support, and creative worth-baking fix#19
Faboit1 merged 2 commits into
mainfrom
claude/item-worth-display-bugs-1hrf2y

Conversation

@Faboit1

@Faboit1 Faboit1 commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up work on the worth-tooltip feature. PR #18 (the original two-bug fix) is already merged; these are the two commits pushed to the branch afterward, which weren't tracked by any open PR.

Changes

1. Stop creative-mode worth re-baking / duplication (b45f5ae)

When a creative client echoes item lore back via SET_CREATIVE_SLOT, Minecraft can prepend a formatting code (e.g. §f) to each lore line during serialization. That broke the startsWith(WORTH_MARKER) match, so the injected worth line was neither stripped on the inbound packet nor de-duplicated on redraw — it baked into the real item and showed duplicates on close/reopen.

  • Detect the marker with contains() instead of startsWith() for both stripping and de-dup.
  • Treat formatting-only lines as blank separators so they don't accumulate.

2. /showworth [true|false] — per-player worth toggle

  • Lets each player show or hide the worth tooltip for themselves; no argument toggles.
  • New WorthVisibilityManager persists the set of opted-out players in worth-visibility.yml (loaded on enable, saved async on change, flushed on disable).
  • The packet decorator now gates per-viewer, and the inventory refreshes immediately when the preference changes.
  • Registered in plugin.yml under sellplugin.use; message strings added to config.yml.

3. Full Folia support

  • Declared folia-supported: true.
  • New Scheduler helper wrapping the region/entity/global/async schedulers (part of the Paper API, so the same code runs on Paper too).
  • The three global-scheduler calls that throw UnsupportedOperationException on Folia — the worth-refresh nudge, the sell-button refresh, and the staggered leaderboard heads — now run on the owning player's region thread; visibility saves use the async scheduler.

Testing note

I could not run mvn package in my sandbox (its egress policy blocks repo.papermc.io), so this PR relies on the CI workflow to validate the build against the real PaperMC dependencies.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 30, 2026 05:24
Creative clients echo lore back via SET_CREATIVE_SLOT, and Minecraft can
prepend a formatting code (e.g. §f) to each lore line on serialization.
That broke the startsWith() marker check, so the injected worth line was
neither stripped on the inbound packet nor de-duplicated on redraw, causing
it to bake into the real item and show duplicates on close/reopen.

Detect the marker anywhere in the line (contains) for both stripping and
de-dup, and treat formatting-only lines as blank separators.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016mt4AzbsKNLtCpekgmSGGU
/showworth [true|false] lets each player show or hide the worth tooltip for
themselves (no arg toggles). The preference persists in worth-visibility.yml
and the packet decorator now gates on it per-viewer; the view refreshes
immediately on change.

Folia: declare folia-supported and route every scheduled task through a new
Scheduler helper that uses the region/entity/global/async schedulers (part of
the Paper API, so the same code runs on Paper too). The three global-scheduler
calls that would throw on Folia — inventory-refresh nudge, sell-button refresh,
and staggered leaderboard heads — now run on the owning player's region thread;
visibility saves run on the async scheduler.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016mt4AzbsKNLtCpekgmSGGU
@Faboit1
Faboit1 merged commit bc301e5 into main Aug 12, 2026
1 check 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