fix: only complain about claim rank when a chunk is actually targeted - #27
Merged
Merged
Conversation
The claim rank was checked before anything had established that the click was a claim gesture, so every left or right click in the world ran the denial branch. Any player below the claim rank was told "Your rank cannot claim chunks for this island!" for opening a chest, pressing a button or mining — throttled to once every two seconds, uncancelled and unlogged, so the interaction still went through and nothing showed in console. The checks that recognise ordinary interaction — clicked block sits in unlocked territory, aim ray finds no locked chunk — all sat below the rank check and never got the chance to bail out. Move the rank check to after the target chunk is resolved, so a low-rank teammate only hears about the claim flag when they genuinely aim at a locked chunk, which is what that message was for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017EZEwab2kL4i1FNnBYvSmp
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The bug
Reported in-game: a non-owner island member gets
Your rank cannot claim chunks for this island!in chat every time they open a chest. The chest opens normally and nothing appears in console.Cause
ChunkClaimListener.onBorderHitchecked the claim rank before anything had established that the click was a claim gesture at all:Every left or right click anywhere in the world reached that branch. The checks that recognise ordinary interaction — the clicked block sitting in unlocked territory, and the aim ray finding no locked chunk — all sat below it and never got the chance to bail out.
So any player below the claim rank was nagged for opening a chest, pressing a button, or mining. It was throttled to once per two seconds, the event was never cancelled (hence the chest still opening), and it is a plain
user.notify(hence no console output).Fix
Move the rank check to after the target chunk is resolved. Order is now:
A low-rank teammate only hears about the claim flag when they genuinely aim at a locked chunk, which is what
denyClaim's "tell teammates why rather than leave them wondering" intent was for. Visitors are still told nothing.Test
testUsingABlockInOwnTerritoryNeverRaisesTheRankComplaint— a MEMBER-rank player with the flag denied right-clicks a block at x=14, z=8 (their own chunk, close enough to the border that the aim line crosses into the locked neighbour) and must be told nothing. Fails on the old ordering.Full suite: 659 tests, 0 failures.
🤖 Generated with Claude Code
https://claude.ai/code/session_017EZEwab2kL4i1FNnBYvSmp