Skip to content

Make Web Library import replace existing challenges - #439

Merged
tastybento merged 2 commits into
developfrom
fix/library-import-replaces-existing
Nov 14, 2026
Merged

tastybento merged 2 commits into
developfrom
fix/library-import-replaces-existing

Conversation

@tastybento

Copy link
Copy Markdown
Member

Summary

Installing a pack from the Web Library asks the admin to confirm "that you want to replace your current challenges with the new ones", but the import was then refused with "Challenges already exist in your world. Cannot proceed!" if the game mode had any challenges or levels. Admins had to find Challenge Wipe first. Import Database and Import Template already wipe and replace.

  • ChallengesImportManager.loadDownloadedChallenges now wipes the game mode's challenges and levels and loads the download, matching the confirmation prompt and the two file imports. Player data is kept.
  • The wipe happens only after the downloaded JSON has parsed, so a broken download leaves the existing challenges in place.
  • Removed the now unused challenges.errors.exist-challenges-or-levels key from all locales.

Testing

  • ChallengesImportManagerTest: replaced the two "existing data is refused" tests with tests that existing data is wiped and replaced, that nothing is wiped when the game mode is empty, and that a malformed download does not wipe.
  • mvn test passes.
  • Not tested on a live server.

🤖 Generated with Claude Code

The Library asks the admin to confirm that the current challenges will
be replaced, but the import was then refused with "Challenges already
exist in your world" whenever the game mode had any. Importing a
database file or a template already wipes and replaces.

Wipe the game mode's challenges and levels before loading the download,
once the download has parsed, so a broken download cannot leave the
world empty. Player data is kept. Remove the now unused
exist-challenges-or-levels locale key.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sonar S2259: Utils.getGameMode returns null when the world does not
belong to a game mode, so building the ID prefix could throw. Resolve
the game mode addon once up front, report not-a-gamemode-world as the
template import does, and reuse the name for the prefix and the wipe.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit af6395e into develop Nov 14, 2026
3 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