Fix 1.28.0 database load failure and GUI block names (1.28.1)#258
Merged
tastybento merged 1 commit intomasterfrom Apr 7, 2026
Merged
Fix 1.28.0 database load failure and GUI block names (1.28.1)#258tastybento merged 1 commit intomasterfrom
tastybento merged 1 commit intomasterfrom
Conversation
The 1.28.0 schema change from Map<Material, Integer> to Map<NamespacedKey, Integer> broke loading of every existing database file, since Gson's reflective handling of NamespacedKey expects an object form for keys but legacy files store bare enum names like "DIRT": 459. Add a NamespacedKeyMapAdapter that reads legacy enum names, namespaced strings, and the complex array form, and writes the clean "minecraft:dirt" form. Annotate blockCounts, blockLimits, and blockLimitsOffset with @JsonAdapter so it is picked up via Gson's reflective factory (BentoBox's @adapter is YAML-only). Also fix LimitTab passing NamespacedKey.toString() through Util.prettifyText, which produced "Minecraft:hopper". Use NamespacedKey.getKey() so the GUI shows "Hopper" again. Bumps version to 1.28.1. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
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
Hotfix for two regressions introduced in 1.28.0:
Map<Material, Integer>toMap<NamespacedKey, Integer>inIslandBlockCountbroke Gson deserialization of every existing JSON file, producingExpected BEGIN_OBJECT but was STRING ... path \$.blockCounts.errors and dropping all stored counts on startup. AddedNamespacedKeyMapAdapter, a GsonTypeAdapterannotated via@JsonAdapteronblockCounts,blockLimits, andblockLimitsOffset, that reads three input shapes (legacy bare enum names, namespaced strings, and the complex array form Gson would have written) and writes the clean"minecraft:dirt"form. No manual migration needed — old files load as-is. (BentoBox's@Adaptermechanism is YAML-only, so@JsonAdapteris required for the JSON database.)Minecraft:hopperinstead ofHopper.LimitTabwas passingNamespacedKey.toString()throughUtil.prettifyText. Now usesNamespacedKey.getKey().Bumps version to 1.28.1.
Test plan
mvn test— 222 passed, 0 failedIslandBlockCountTestcover: loading the exact legacy shape from a real user-supplied broken file, loading the new namespaced format, and a write/read round-trip — all run through a Gson configured identically to BentoBox'sAbstractJSONDatabaseHandler.🤖 Generated with Claude Code