Skip to content

fix: let players accept a linked co-ownership token with any right-click - #47

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/coown-token-accept
Sep 26, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/coown-token-accept

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fixes the "Co-owner tokens not working" bug report. A player handed a linked Co-Ownership Token could only accept it by right-clicking open air. Right-clicking the ground did nothing. Right-clicking the animal, or its owner, replied "This is not your animal."
  • A non-owner holding a token linked to an owned animal now accepts it on any right-click: air, block, animal or player.
  • Owners are unchanged. They link the token by right-clicking their animal and give it by right-clicking a player. After linking they no longer get a stray "Already an owner of this animal." A client sends a use-item packet after every entity click, and that packet used to trigger the message.
  • The decision lives in the new HusbandryCoOwnToken, so every click path applies the same rule.

Documentation impact

Contract

  • Affected behavior: right-clicks with a linked Co-Ownership Token. Unlinked tokens and owners behave as before.
  • Tests run (mvn test, or why not): mvn clean verify locally, 210 tests passed, including the new HusbandryCoOwnTokenTest. Bot e2e on TFMCDev01 follows.
  • Player wiki (ProvinceSystem /wiki/cooking or related pages): no change. The animal husbandry page describes the owner-to-player flow, which still works.

Notes

  • Config source is src/main/resources. Do not edit target/.
  • cookware.yml is not loaded.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Co-ownership tokens can be used in supported interactions to share ownership of an animal.
  • Bug Fixes
    • Invalid, unlinked, or otherwise ineligible tokens are rejected, preventing unintended ownership changes.

A player handed a linked Co-Ownership Token could only accept it by
right-clicking open air. Clicking the ground did nothing, and clicking
the animal or its owner replied "This is not your animal."

A non-owner holding a token linked to an owned animal now accepts it on
any right-click: air, block, animal or player. Owners keep linking and
giving, and no longer get "Already an owner" after linking.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5f41ef8c-d596-4cd4-94d4-af08faa8e595

📥 Commits

Reviewing files that changed from the base of the PR and between 729ad1a and bdf7974.

📒 Files selected for processing (3)
  • src/main/java/net/tfminecraft/cooking/husbandry/HusbandryCoOwnToken.java
  • src/main/java/net/tfminecraft/cooking/husbandry/HusbandryTamingListener.java
  • src/test/java/net/tfminecraft/cooking/husbandry/HusbandryCoOwnTokenTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change adds co-ownership token parsing and acceptance checks. The taming listener applies the checks during entity and right-click interactions. Tests cover token parsing and acceptance conditions.

Changes

Co-ownership token handling

Layer / File(s) Summary
Token parsing and acceptance rules
src/main/java/net/tfminecraft/cooking/husbandry/HusbandryCoOwnToken.java, src/test/java/net/tfminecraft/cooking/husbandry/HusbandryCoOwnTokenTest.java
The utility parses valid UUID strings and checks token linkage and ownership conditions. Tests cover accepted and rejected ownership cases, plus valid and invalid parsing inputs.
Interaction handling and co-owner assignment
src/main/java/net/tfminecraft/cooking/husbandry/HusbandryTamingListener.java
Entity and right-click interactions now validate co-ownership tokens before adding co-owners. onInteractUse handles right-clicks in air or on blocks and cancels the event only for accepted tokens.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to bdf79

The reviewed token-acceptance paths match the intended behavior. No identified issue blocks merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to bdf79

The new click routes use the existing co-owner assignment checks. A token holder could already accept a linked token by clicking air; this change makes that action work on blocks and entities too. No newly introduced ownership bypass was established, but token authenticity and interrupted-write behavior remain incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • observed — An accepted token targets the clicking player as co-owner of its linked animal, not the clicked player or entity. The ownership service rejects animals without owners, existing target owners, and targets at capacity.

Trust Boundaries and Controls

  • inferred — A holder able to present a matching item with an arbitrary linked UUID could seek co-ownership without proving owner issuance. The inspected acceptance path does not verify issuance, but whether players can create such an item was not established, and the base air-click path already offered the same self-claim outcome.

Resilience and Maintainability Implications

  • observed — Ownership persistence and token consumption are not one atomic operation. This pre-existing ordering can leave partial state after interruption; the PR reuses it rather than introducing a new persistence sequence.

Hardening Proposals

  • proposed — Separately verify whether players can forge matching linked-token metadata. If they can, consider binding tokens to owner-authorized issuance rather than relying on the stored animal UUID alone.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: linked co-ownership tokens can be accepted with any right-click.
Description check ✅ Passed The description follows the repository template and explains the behavior change, documentation impact, affected behavior, tests run, wiki impact, and notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

A rabbit checks a token’s trail
For linked UUIDs, strong and clear
When owners match the proper rules
A co-owner joins the burrow crew
Then carrots celebrate the change

Comment @coderabbitai help to get the list of available commands.

@XxFran10xX
XxFran10xX merged commit d7542c5 into main Sep 26, 2026
2 checks passed
@XxFran10xX
XxFran10xX deleted the fix/coown-token-accept branch September 26, 2026 23:52
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