Skip to content

Add regression test confirming island home location is set on the correct island during concurrent creation#2969

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-island-creation-home-location
Draft

Add regression test confirming island home location is set on the correct island during concurrent creation#2969
Copilot wants to merge 2 commits intodevelopfrom
copilot/fix-island-creation-home-location

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

When a player spams /is create, a race condition caused island 1's home location to be overwritten with island 2's spawn point. The bug: postCreationTask called setHomeLocation(user, spawn), which resolves the target island by UUID primary-island lookup — but by the time island 1's paste callback fires, island 2 creation has already updated the primary pointer, so the home lands on the wrong island.

The fix (setHomeLocation(island, spawn, "")) was already applied in the codebase, targeting the specific island object directly.

Changes

  • Regression test (testBuilderWithSpawnPointSetsHomeOnIslandDirectly): makes the Bukkit scheduler execute the post-creation runnable inline, stubs a non-null spawn point, then asserts:
    • setHomeLocation(island, spawnLoc, "") is called with the exact island reference
    • setHomeLocation(user, ...) is never called during island creation
// BAD (original) — resolves via primary-island UUID lookup, wrong island under concurrency
plugin.getIslands().setHomeLocation(user, island.getSpawnPoint(Environment.NORMAL));

// GOOD (current) — targets the specific island object, immune to primary-island pointer races
plugin.getIslands().setHomeLocation(island, island.getSpawnPoint(Environment.NORMAL), "");

Copilot AI changed the title [WIP] Fix island creation changing home location of previous island Add regression test confirming island home location is set on the correct island during concurrent creation May 5, 2026
Copilot AI requested a review from tastybento May 5, 2026 15:27
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.

Island creation changes the home location of previous

2 participants