Skip to content

Add /island lock command to toggle island lock state and expel visitors#2858

Merged
tastybento merged 4 commits intodevelopfrom
copilot/add-is-lock-command
Mar 14, 2026
Merged

Add /island lock command to toggle island lock state and expel visitors#2858
tastybento merged 4 commits intodevelopfrom
copilot/add-is-lock-command

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

Players want a quick /is lock command to lock their island and expel visitors, rather than navigating the /is settings GUI.

Changes

New command: IslandLockCommand

  • Registered as lock subcommand under the default player island command
  • Toggles the LOCK flag between VISITOR_RANK (open) and MEMBER_RANK (locked)
  • When locking: iterates players on the island and expels non-team-members — sending them home if they have one, or to spawn otherwise
  • Respects configurable rank requirement via setConfigurableRankCommand()
  • Fires IslandEvent.Reason.LOCK on toggle
  • Island instance cached as a field (set in canExecute, used in execute) following the pattern used by IslandSettingsCommand

Locale

Added commands.island.lock strings (description, locked, unlocked, you-are-locked-out) to all supported locales:

  • en-US (English)
  • cs, de, es, fr, hr, hu, id, it, ja, ko, lv, nl, pl, pt, pt-BR, ro, ru, tr, uk, vi, zh-CN, zh-HK

Tests

  • IslandLockCommandTest — 12 tests covering setup, canExecute (no island, low rank, has island, in team), and execute (lock, unlock, lock with visitors, lock with no-home visitors, members not expelled, null island safety)
  • Updated DefaultPlayerCommandTest subcommand count (19 → 20)
Original prompt

This section details on the original issue you should resolve

<issue_title>Can we have a /is lock command</issue_title>
<issue_description>In Askyblock, it contain a /is lock command which let player easier to lock their island and expel all the existing player on the island.
However, this function is moved into /is settings now. Player always complained that it is complicated. They want to do that in a simple way.
Can you guys add back the /is lock command in the future update?</issue_description>

Comments on the Issue (you are @copilot in this section)

@Poslovitch Moving to BentoBox/ @BONNe You can do it with the ./[player_command] settings So it is not a priority currently.

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copilot AI changed the title [WIP] Add /is lock command for simpler island management Add /island lock command to toggle island lock state and expel visitors Mar 14, 2026
Copilot AI requested a review from tastybento March 14, 2026 19:37
@tastybento tastybento marked this pull request as ready for review March 14, 2026 19:51
@tastybento
Copy link
Copy Markdown
Member

@copilot Review the SonarCloud issues reported and address them. Also, translate the English into the other locales.

…r all locales

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 14, 2026

@copilot Review the SonarCloud issues reported and address them. Also, translate the English into the other locales.

Done in commit a99480f:

SonarCloud fixes: Refactored IslandLockCommand to follow the IslandSettingsCommand caching pattern — the island is now stored as a @Nullable field, set in canExecute and reused in execute. This eliminates the double getIsland() call and the Objects.requireNonNull usage that were potential SonarCloud flagging points.

Translations: Added the lock command strings to all 22 non-English locale files: cs, de, es, fr, hr, hu, id, it, ja, ko, lv, nl, pl, pt, pt-BR, ro, ru, tr, uk, vi, zh-CN, zh-HK.

@tastybento
Copy link
Copy Markdown
Member

@copilot For the translations, you should use [prefix_island] as a placeholder for the game mode's word for "island", which may change depending on the game mode, e.g., area, box, etc.

…ommand

Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 14, 2026

@copilot For the translations, you should use [prefix_island] as a placeholder for the game mode's word for "island", which may change depending on the game mode, e.g., area, box, et...

Done in commit 99e1aec. All 22 non-English locale files now use [prefix_island] instead of hard-coded native words for "island". The uk locale already had it; the remaining 21 have been updated.

@sonarqubecloud
Copy link
Copy Markdown

@tastybento tastybento merged commit caa782a into develop Mar 14, 2026
3 checks passed
@tastybento tastybento deleted the copilot/add-is-lock-command branch March 14, 2026 20:51
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.

Can we have a /is lock command

2 participants