Skip to content

fix: don't count transferred island against limit in setowner (#2996)#2997

Merged
tastybento merged 1 commit into
developfrom
fix/2996-setowner-island-limit
Jun 27, 2026
Merged

fix: don't count transferred island against limit in setowner (#2996)#2997
tastybento merged 1 commit into
developfrom
fix/2996-setowner-island-limit

Conversation

@tastybento

Copy link
Copy Markdown
Member

Fixes #2996

Problem

/is team setowner <player> refused the transfer with "The specified player has reached the maximum number of islands allowed on the server." when the concurrent-island limit was reached — even though the target is already a member of the island being transferred and gains no new island. With a limit of 1, a member whose only island is this one always hit the cap.

This blocks mobile players, who have no left/right-click and cannot use the /is team GUI, so setowner is their only way to transfer ownership.

Cause

IslandsManager#getNumberOfConcurrentIslands counts every island the player owns or is a member of. Since IslandTeamSetownerCommand requires the target to already be a team member, the island being transferred is already included in num, so num >= max fires one island too early.

Fix

Discount the island being transferred from the count before the cap check:

  • IslandTeamSetownerCommand — the target is always a member at this point (enforced earlier), so num is decremented unconditionally.
  • AdminTeamSetownerCommand — the target may not be a member (admin stands on any island), so it is decremented only when island.inTeam(targetUUID).

The transfer is now rejected only when the target has max other islands, preserving the limit added in #2908.

Tests

  • Adds testCanExecuteTargetIsMemberOfOnlyThisIslandAtLimit — a member whose only island is the one being transferred, at a limit of 1, can now receive ownership. (Fails before the fix, passes after.)
  • Updates testCanExecuteTargetAtConcurrentIslandsCap so the target owns max other islands plus this one, confirming the cap still blocks genuine over-limit transfers.

🤖 Generated with Claude Code

/is team setowner refused ownership transfer with the "maximum number of
islands" error when the concurrent-island limit was reached, even though
the target is already a member of the island being transferred and is not
gaining a new island.

getNumberOfConcurrentIslands counts every island the player owns or is a
member of, so the island being transferred is already included in the
target's total. The cap check now discounts it: in IslandTeamSetownerCommand
the target is always a member (enforced earlier), and in
AdminTeamSetownerCommand it is discounted only when the target is already a
member. The transfer is rejected only when the target has max OTHER islands,
preserving the limit added in #2908.

Adds a regression test for a member whose only island is the one being
transferred at a limit of 1, and updates the existing cap test to reflect
that the transferred island is discounted.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@tastybento tastybento merged commit a3345c5 into develop Jun 27, 2026
3 checks passed
@tastybento tastybento deleted the fix/2996-setowner-island-limit branch June 27, 2026 22:49
@tastybento tastybento mentioned this pull request Jun 27, 2026
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.

/is team setowner wrongly blocked by island limit when target is already a member

1 participant