Skip to content

Only offer 'Click to change' in the phases GUI to players who can use it - #545

Merged
tastybento merged 1 commit into
developfrom
fix/phases-panel-setcount-permission
Jul 29, 2026
Merged

Only offer 'Click to change' in the phases GUI to players who can use it#545
tastybento merged 1 commit into
developfrom
fix/phases-panel-setcount-permission

Conversation

@tastybento

Copy link
Copy Markdown
Member

What

The phases panel (/ob phases) offered the SELECT action — and its "Click to change" tooltip — based on island state and phase requirements alone, without checking whether the player holds the permission of the setcount command that clicking runs. A player with aoneblock.island.setcount negated saw the tooltip and then got "You don't have the permission to execute this command" when clicking.

canApplyPhase now resolves the setcount subcommand and checks its permission before offering the action, so the tooltip only shows when the click can succeed. If the command cannot be resolved, the panel stays permissive and lets the command's own permission check decide.

Why

Same defect as BentoBoxWorld/ChunkBlock#11 — ChunkBlock's panel was copied from this code and both had the missing check. The ChunkBlock side is already fixed on its develop branch.

Testing

Two new tests cover permission granted and negated; the full suite (555 tests) passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Y7xSdVPS5vRu6wqf6XshRq

The phases panel offered the SELECT action (and its 'Click to change'
tooltip) based on island state and phase requirements alone, without
checking whether the player actually holds the permission of the setcount
command the click runs. A player with aoneblock.island.setcount negated
saw the tooltip and then got a permission error when clicking. The panel
now resolves the setcount subcommand and checks its permission before
offering the action; if the command cannot be resolved it stays permissive
and lets the command's own check decide.

Same defect as BentoBoxWorld/ChunkBlock#11, whose panel code was copied
from this one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y7xSdVPS5vRu6wqf6XshRq
@sonarqubecloud

Copy link
Copy Markdown

@tastybento
tastybento merged commit 3b63e39 into develop Jul 29, 2026
3 checks passed
@tastybento tastybento mentioned this pull request Jul 29, 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.

1 participant