Skip to content

2.6.2 - Fix JsonShopConfiguration saves - #157

Open
SparklingComet wants to merge 58 commits into
masterfrom
2.6.2
Open

SparklingComet wants to merge 58 commits into
masterfrom
2.6.2

Conversation

@SparklingComet

Copy link
Copy Markdown
Member

Pull Request Etiquette

There are several guidelines you should follow in order for your Pull Request to be merged.
Replace [ ] with [x] to cross the checkbox.

It is sometimes better to include more related changes in a single commit.
If you find yourself having an overwhelming amount of commits, you
can rebase your branch.

Changes

Fix for bug reported on discord about shop deletion not being saved/reflected in save files. Also introduces a thread (task) pool system for better performance. The previous async saving implementation relying on HashMaps as semaphores/locks was only a band-aid fix.

I have done some basic testing with 1-2 threads, more stress-testing (more queued save jobs, more threads) would be helpful.

- Added save validation that checks for excess '{' or '}' and attempts to re-save with them removed
- There is a good chance this will not properly load existing shop data. To prevent this from affecting servers that haven't confirmed, the Message Prefix setting in the config will need to START with `§a§b§2§3§6§1`
- There is a good chance this will not properly load existing shop data. To prevent this from affecting servers that haven't confirmed, the Message Prefix setting in the config will need to START with `§a§b§2§c§6§1`
- There is a good chance this will not properly load existing shop data. To prevent this from affecting servers that haven't confirmed, the Message Prefix setting in the config will need to START with `§a§f§2§c§6§1`
KillerOfPie and others added 12 commits November 25, 2023 15:17
- There is a good chance this will not properly load existing shop data. To prevent this from affecting servers that haven't confirmed, the Message Prefix setting in the config will need to START with `§a§3§c§2§f§6`
- There is a good chance this will not properly load existing shop data. To prevent this from affecting servers that haven't confirmed, the Message Prefix setting in the config will need to START with `§a§3§c§2§f§6`
- fox for findchest npe
- fix for concurrentmod exception
- Fix for missing config #
- Removed FileCache from JsonConfiguration
@hmlendea

hmlendea commented Jul 4, 2024

Copy link
Copy Markdown

Will this get merged?

SparklingComet and others added 5 commits September 13, 2024 21:25
- '${outputDir}' variable defines where all build/final files are placed
- Temp files during build are placed in  './PreShade/'
- Final server files(Plugin Jar) are placed in './server/plugins/'
- Final Build Artifacts(Plugin Jar and Javadocs if enabled) are place in './'
paper-api is pinned to 1.20.1-R0.1-20230627.215235-38. Paper's repository
retains only the newest build per snapshot line, so that exact artifact now
404s in all four configured repositories and dependency resolution fails
before anything compiles. Every other dependency still resolves, so a clone of
this branch fails at the very first step with an error that looks like a
network problem rather than a stale pin.

1.20.1-R0.1-SNAPSHOT resolves to build -178, the only one remaining on that
line. With it, mvn -B clean package exits 0 in ~7s and produces the shaded
TradeShop-2.6.2-DEV.jar.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011W23q6P3iA4WUtBKvUGFEg
KillerOfPie and others added 11 commits August 7, 2026 05:19
Unpin paper-api from a purged snapshot so the branch builds
Make saving single threaded again
… alive on new JDKs

paper-api is declared first and pinned to spigot-api's version - both
jars ship org.bukkit.* and only the first copy is used, so ordering
silently decides which patches exist at run time. BKCommonLib goes to
2.0.2, the line current servers run; the pinned 1.20.2-v1 carries no
1.21 support at all. <proc>full</proc> keeps Lombok's annotation
processing running on JDK 23+, which otherwise skips classpath
processors and fails the compile with 150 missing accessors. Shade,
javadoc, bstats and Lombok are routine bumps.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJGccjKqRdo8Ax24c44rBS
Three production classes import com.bergerkiller.bukkit.common.config
types, but the artifact is provided-scope so shade never packages it,
and plugin.yml never named it - so a server without BKCommonLib
installed fails onEnable with NoClassDefFoundError before writing its
config. depend: makes the requirement explicit and the failure
legible: the server reports the missing plugin by name instead of a
stack trace.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJGccjKqRdo8Ax24c44rBS
Every fix here was pinned by a test that failed first on a real Paper
server, then made green. The highlights, each an open or closed issue
on this tracker:

- The startup repair truncated any shop file whose item carried a
  custom name or lore (#153, #159, #162, #165, #166, #167): it split
  files on a regex that matches ordinary content now that item
  components embed JSON in strings. Repair now parses, and only
  rewrites a file that genuinely fails to parse.
- Shops lost their product, cost, chest location and per-shop settings
  on restart: deep keySet() flattening, and a deserialize that saved
  over the very file it was still reading.
- Item metadata (names, lore, enchantments, potion effects, shulker
  contents) was dropped when pre-component data was read back.
- Potions compared by material alone - a water bottle paid for a
  Potion of Strength (#150's comparison half).
- A shop whose chest was removed threw on every trade (#160); sign
  editing on 1.20+ opened the editor instead of trading (#152) because
  the Paper guard's version sniff no longer matched Paper's version
  string - replaced by a capability test.
- /tradeshop find threw for any player near a chunk holding a shop,
  and max-shops-per-chunk counted one shop as 22 keys.
- Shops with a manager or member could not be loaded at all.
- A search no longer creates a data file for every chunk it looks at,
  and legacy-named chunk files are actually found and migrated.
- Pale oak and wall-hanging signs work; 225 lines of hand-maintained
  per-version material lists are gone, sourced from the running server
  instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJGccjKqRdo8Ax24c44rBS
2.6.2: the data-loss line, fixed — storage, comparison, signs, config and commands
Twelve test classes drive create, stock, trade, sign recognition, item
metadata round-trips, per-item setting toggles in both directions, tab
completion and chunk-data caching through the real onEnable, against
the classpath the plugin ships against. The pom grows its test half:
MockBukkit and JUnit at test scope, testRelease 21 for the test
sources only, one surefire fork per suite because the plugin caches
itself in static finals, and an antrun step that fails the build on
any skipped test - MockBukkit reports unimplemented API as a skip, so
without that guard a green run can mean nothing ran.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJGccjKqRdo8Ax24c44rBS
Tier 2 boots a real Paper server with the shaded jar and BKCommonLib
installed and runs 69 scenarios from inside: shops created by command,
stocked from real chests, traded, broken, reloaded off disk, searched,
and every per-item comparison toggled both ways. Tier 3 connects a
real client (Mineflayer) that places the chest, types the sign edit -
the one path no server-side tier can reach - trades through the GUI,
and proves a toggled comparison changes what the shop accepts. Sites
are allocated by a runtime reservation so suites cannot collide, and
a scenario that declared itself but did not run fails the build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJGccjKqRdo8Ax24c44rBS
sh ci/build.sh builds, runs tier 1, then boots the server for tiers 2
and 3. It exits 1 on a failed assertion, on a severe console line even
with every scenario green, on a scenario that did not run, and on a
hang - each proven by inducing it rather than assumed. Ports are
allocated per checkout so parallel runs do not queue. The .gitignore
line keeps agent scratch directories out of accidental commits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJGccjKqRdo8Ax24c44rBS
Adds the Actions workflow the 2.6.2 fix line and its harness were
gated by on the staging fork: one job, sh ci/build.sh, which builds,
runs the MockBukkit suite, boots a real Paper server for the in-server
scenarios, and drives a real client against it. It fails on a broken
assertion, a severe console line, a skipped test, a scenario that did
not run, or a hang.

Publishing is unaffected: permissions are contents read, there is no
deploy step, no schedule and no manual trigger - Jenkins remains the
sole publisher for repo.killerofpie.com. Triggers are branch-agnostic
so the gate follows the work instead of a named branch. JDK 21 because
MockBukkit's v1.21 line is compiled for it (main still targets 1.8);
Node 24 for the protocol client, whose dependency tree is locked by
it-client/package-lock.json.

Retires the disabled maven.yml.old it replaces.
2.6.2: the test harness the fix line was proven against
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants