Skip to content

Switch blueprints from zipped .blu to plain JSON .blueprint format#2911

Merged
tastybento merged 4 commits into
developfrom
copilot/define-island-blueprint-text-files
Apr 6, 2026
Merged

Switch blueprints from zipped .blu to plain JSON .blueprint format#2911
tastybento merged 4 commits into
developfrom
copilot/define-island-blueprint-text-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 5, 2026

Blueprint files were stored as zipped binary .blu files, making version control diffs impossible. This switches to plain JSON .blueprint files while retaining backward-compatible loading of legacy .blu files.

Storage format change

  • BLUEPRINT_SUFFIX changed from .blu to .blueprint
  • New LEGACY_BLUEPRINT_SUFFIX = ".blu" constant for backward compat
  • saveBlueprint() writes plain JSON directly — no zipping, no temp files
  • Removed unused zip() method from BlueprintClipboardManager

Load path: new format first, legacy fallback

// Try plain JSON .blueprint first
File jsonFile = new File(blueprintFolder, fileName + BlueprintsManager.BLUEPRINT_SUFFIX);
if (jsonFile.exists()) {
    return loadBlueprintFromJson(jsonFile, fileName);
}
// Fall back to legacy zipped .blu
File zipFile = new File(blueprintFolder, fileName + BlueprintsManager.LEGACY_BLUEPRINT_SUFFIX);
if (zipFile.exists()) {
    return loadBlueprintFromZip(zipFile, fileName);
}

Updated all file operations to handle both formats

  • loadBlueprints() scans for both .blueprint and .blu files
  • deleteBlueprint() / renameBlueprint() clean up both formats
  • extractDefaultBlueprints() extracts both from addon JARs
  • Admin commands (list, load, save, rename) recognize both suffixes in tab completion, existence checks, and file listing

Tests

  • Existing tests updated for .blueprint output
  • Added tests for plain JSON loading, legacy .blu loading, and format precedence when both exist

Copilot AI linked an issue Apr 5, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits April 5, 2026 22:19
…th backward compatibility

- Change BLUEPRINT_SUFFIX from '.blu' to '.blueprint' for new plain JSON format
- Add LEGACY_BLUEPRINT_SUFFIX constant for '.blu' backward compatibility
- Update BlueprintClipboardManager to save as plain JSON (no zipping)
- Update BlueprintClipboardManager to load .blueprint first, fall back to .blu
- Update BlueprintsManager to scan for both file formats when loading
- Update delete/rename operations to handle both formats
- Update admin commands (list, load, save, rename) to support both formats
- Update all tests for new format and add legacy backward compatibility tests

Agent-Logs-Url: https://github.com/BentoBoxWorld/BentoBox/sessions/64819466-6133-4499-98b9-2d03490ea00e

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option for island blueprint in JSON/YAML format Switch blueprints from zipped .blu to plain JSON .blueprint format Apr 5, 2026
@tastybento tastybento marked this pull request as ready for review April 5, 2026 22:28
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 5, 2026

Copilot AI requested a review from tastybento April 5, 2026 23:10
@tastybento tastybento merged commit e3c2148 into develop Apr 6, 2026
3 checks passed
@tastybento tastybento deleted the copilot/define-island-blueprint-text-files branch April 6, 2026 00:06
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.

Define Island Blueprint Using Text Files

2 participants