Add /showworth toggle, Folia support, and creative worth-baking fix - #19
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 thestartsWith(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.contains()instead ofstartsWith()for both stripping and de-dup.2.
/showworth [true|false]— per-player worth toggleWorthVisibilityManagerpersists the set of opted-out players inworth-visibility.yml(loaded on enable, saved async on change, flushed on disable).plugin.ymlundersellplugin.use; message strings added toconfig.yml.3. Full Folia support
folia-supported: true.Schedulerhelper wrapping the region/entity/global/async schedulers (part of the Paper API, so the same code runs on Paper too).UnsupportedOperationExceptionon 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 packagein my sandbox (its egress policy blocksrepo.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