Skip to content

Fix 1.28.0 database load failure and GUI block names (1.28.1)#258

Merged
tastybento merged 1 commit intomasterfrom
develop
Apr 7, 2026
Merged

Fix 1.28.0 database load failure and GUI block names (1.28.1)#258
tastybento merged 1 commit intomasterfrom
develop

Conversation

@tastybento
Copy link
Copy Markdown
Member

@tastybento tastybento commented Apr 7, 2026

Summary

Hotfix for two regressions introduced in 1.28.0:

  • Pre-1.28.0 databases fail to load. The schema change from Map<Material, Integer> to Map<NamespacedKey, Integer> in IslandBlockCount broke Gson deserialization of every existing JSON file, producing Expected BEGIN_OBJECT but was STRING ... path \$.blockCounts. errors and dropping all stored counts on startup. Added NamespacedKeyMapAdapter, a Gson TypeAdapter annotated via @JsonAdapter on blockCounts, blockLimits, and blockLimitsOffset, 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 @Adapter mechanism is YAML-only, so @JsonAdapter is required for the JSON database.)
  • Limits GUI showed Minecraft:hopper instead of Hopper. LimitTab was passing NamespacedKey.toString() through Util.prettifyText. Now uses NamespacedKey.getKey().

Bumps version to 1.28.1.

Test plan

  • mvn test — 222 passed, 0 failed
  • New tests in IslandBlockCountTest cover: 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's AbstractJSONDatabaseHandler.
  • Manual: load a pre-1.28.0 database on a real server and confirm block counts are preserved and the limits GUI shows readable names.

🤖 Generated with Claude Code

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>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 7, 2026

@tastybento tastybento merged commit 7478046 into master Apr 7, 2026
5 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.

1 participant