Skip to content

Refuse setowner when recipient is at the concurrent-islands cap#2966

Merged
tastybento merged 1 commit intodevelopfrom
fix/2908-concurrent-islands-setowner
May 5, 2026
Merged

Refuse setowner when recipient is at the concurrent-islands cap#2966
tastybento merged 1 commit intodevelopfrom
fix/2908-concurrent-islands-setowner

Conversation

@tastybento
Copy link
Copy Markdown
Member

Summary

  • Refuses ownership transfer (admin and user-facing) when the recipient is already at their concurrent-islands cap, instead of letting the transfer through and merely warning afterwards.
  • Adds a parallel admin error message (commands.admin.team.setowner.errors.at-max) and wires up the existing user-facing commands.island.team.setowner.errors.at-max entry that was previously unused.

Why

Setting concurrent-islands: 1 (or any per-player island.number.<n> permission) only gated IslandCreateCommand. A player could be added as a member, then have the island handed to them via /is team setowner or /bbox team setowner, ending up with multiple owned islands regardless of the limit. AdminTeamSetownerCommand carried a post-transfer "warning" that the player now owns more than allowed, but it never actually blocked the action.

The fix moves the check into canExecute so the cap holds in both flows. An admin who really wants to push a recipient over the limit can raise their island.number.<n> permission first; the error message tells them exactly that.

Test plan

  • ./gradlew test --tests AdminTeamSetownerCommandTest --tests IslandTeamSetownerCommandTest
  • ./gradlew build -x test
  • New testCanExecuteTargetAtConcurrentIslandsCap cases on both commands cover the refusal path.

Closes #2908.

Both AdminTeamSetownerCommand and IslandTeamSetownerCommand previously
allowed ownership transfer to a player who already owned their maximum
allowed concurrent islands. AdminTeamSetownerCommand only emitted a
warning after the fact; IslandTeamSetownerCommand had no check at all.
This was a clean bypass of `concurrent-islands` and the per-player
`island.number.<n>` permission cap.

Both commands now compute the recipient's current concurrent island
count and permission-aware cap in canExecute and refuse the transfer
when at or above the limit. The user-facing path uses the existing
`commands.island.team.setowner.errors.at-max` locale entry; the admin
path gets a parallel `commands.admin.team.setowner.errors.at-max`
message that includes the count and limit so the admin can adjust the
recipient's permission if they really intend to allow it.

Closes #2908.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@tastybento tastybento merged commit 62968f3 into develop May 5, 2026
3 checks passed
@tastybento tastybento deleted the fix/2908-concurrent-islands-setowner branch May 5, 2026 01:36
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.

The bug list of "disallow-team-member-islands: false"

1 participant