Skip to content

feat: pass a solo realm to its dead leader's will heir - #206

Merged
XxFran10xX merged 3 commits into
mainfrom
feat/will-heir-realms
Oct 24, 2026
Merged

XxFran10xX merged 3 commits into
mainfrom
feat/will-heir-realms

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Solo players lose their faction when their character dies for good. The realm is held for a week (HeldRealms) and then closes unless staff seat someone. This lets a will carry the realm on, so players like egg (Omeleth) keep their progress.

  • Once held-realm-heir-wait-hours (24, matching RPCharacters' estates.wait-hours) have passed since the death, the heir named in the dead leader's will joins the held realm and becomes its leader. A revive inside that window still gives the realm back to the leader first.
  • Conditions: the heir is alive and in no faction, the held week has not run out (a war that keeps the realm open does not extend it), nobody else has been let in, the closure has not begun, and the dead leader's estate is OPEN or DECIDED (not held or reverted by staff).
  • It is checked hourly with the other held-realm work, and when a character starts playing. An heir who is in another faction is told, when they start playing, to leave it before the week runs out.
  • The heir is read from the dead character's saved RPCharacters file (will-heir) through Database.readSavedAccount. That method is in the pinned rpcharacters 2.16.0 and in 2.31.0, so the dependency does not change. A will cannot change after death, and RPCharacters' own estate reconcile reads the same field. Without RPCharacters, or if the file can't be read, nobody inherits.
  • After the hand-off the realm is live with a leader, so GuildEstateFallback stops answering UNAVAILABLE and the estate decides as usual: the guild leader (the heir) gets the property and the locks.
  • A failed save puts the hold back and is retried next hour, the same as the revive path.

Player messages:

  • <dead> left you <realm> in their will. You now lead it.
  • <dead> left you <realm> in their will. Leave <faction> within N days to take it on.

Tests

  • HeldRealmsHeirTest covers: the wait, revive priority, session start, an heir in another faction (with the deadline text), no usable will, a dead heir, an estate stopped by staff, a realm staff let someone into, a closing realm, an unreadable leader, save failure and rollback, the config wait, and the expired week with and without a war.
  • WillHeirsTest covers reading the file and every way the heir can be missing or unreadable. EstateBridgeTest covers heirMayInherit for each estate state and failure.
  • New code is fully line-covered locally. The local Windows run also fails the known directory-fsync tests (e.g. three closure checks in HeldRealmsTest, GuildEstateFallbackTest); Linux CI is authoritative.

Dev (TFMCDev01)

Tested with this branch's jar (b34c3f1, then b9fd88a) and held-realm-heir-wait-hours: 0.05, using bots with real characters:

  1. WillHeirA founded Willhold, named WillHeirB's character in /will, and was permakilled. The realm was held.
  2. B logged in before the wait ended: nothing happened. After it: Gave Willhold to <B>, the will heir of its dead leader <A>. B is the leader and only member, and the hold is cleared.
  3. Chain: B named WillHeirD and was permakilled. D logged in after the wait and saw "Ansel Testwood left you Willhold in their will. You now lead it." D now leads the realm.
  4. Retest on b9fd88a: D named WillHeirE and was permakilled. E saw "Elsa Testwood left you Willhold in their will. You now lead it." and the log shows Gave Willhold to <E>, the will heir of its dead leader <D>.
  5. No new errors or warnings in the Dev log. Dev's config is back to normal; the jar stays on Dev.

Wiki

/wiki/characters, "Wills and inheritance", says "Leading a guild or realm never passes by will." That is no longer true for the last member of a realm and needs a separate TFMCWeb change. The hidden wait and the details can stay off the wiki; one line is enough, e.g. "If your character was the last member of their realm, your heir takes it on a day after your death, if they are alive and in no faction."

Reviewed by Sol (round 1 found the expired-week case, fixed in b34c3f1; round 2 approved).

🤖 Generated with Claude Code

XxFran10xX and others added 2 commits October 24, 2026 22:13
A realm whose last member died is held for a week and then closes. Once
held-realm-heir-wait-hours (24) have passed, the heir named in the dead
leader's will now takes it on, if alive and in no faction, unless staff
held or reverted the estate. Checked hourly and when the heir starts
playing; an heir in another faction is told to leave it first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3163891c-b705-486b-aedd-5e09c8817ccd
Commits

Reviewing files that changed from the base of the PR and between 2dd360f and b9fd88a.

Files selected for processing: 12
  • src/main/java/net/tfminecraft/simplefactions/Cache.java
  • src/main/java/net/tfminecraft/simplefactions/estate/EstateBridge.java
  • src/main/java/net/tfminecraft/simplefactions/estate/EstateCalls.java
  • src/main/java/net/tfminecraft/simplefactions/guild/HeldRealms.java
  • src/main/java/net/tfminecraft/simplefactions/identity/LeaderCharacterListener.java
  • src/main/java/net/tfminecraft/simplefactions/integration/rpcharacters/WillHeirs.java
  • src/main/java/net/tfminecraft/simplefactions/loaders/ConfigLoader.java
  • src/main/resources/config.yml
  • src/test/java/net/tfminecraft/simplefactions/estate/EstateBridgeTest.java
  • src/test/java/net/tfminecraft/simplefactions/guild/HeldRealmsHeirTest.java
  • src/test/java/net/tfminecraft/simplefactions/guild/HeldRealmsTest.java
  • src/test/java/net/tfminecraft/simplefactions/integration/rpcharacters/WillHeirsTest.java

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

📝 Summary

Summary by CodeRabbit

  • New Features
    • Held realms can now pass to the deceased leader’s eligible will heir after a configurable waiting period, provided the heir is alive and unaffiliated.
    • Added the held-realm-heir-wait-hours setting, which defaults to 24 hours and supports fractional values.
    • If the former leader is revived during the wait, the realm returns to them. Inheritance is not attempted after the held-week deadline.

The change adds will-heir lookup and estate eligibility checks for held realms. It adds a configurable wait period and attempts inheritance when an heir starts playing or during hourly processing. The transfer respects realm and heir conditions and restores the held state if saving fails.

Changes: Held-realm inheritance

Layer / File(s) Summary
Configure heir eligibility
src/main/java/net/tfminecraft/simplefactions/Cache.java, src/main/java/net/tfminecraft/simplefactions/loaders/ConfigLoader.java, src/main/resources/config.yml, src/main/java/net/tfminecraft/simplefactions/integration/rpcharacters/WillHeirs.java, src/main/java/net/tfminecraft/simplefactions/estate/EstateBridge.java, src/main/java/net/tfminecraft/simplefactions/estate/EstateCalls.java, src/test/java/net/tfminecraft/simplefactions/integration/rpcharacters/WillHeirsTest.java, src/test/java/net/tfminecraft/simplefactions/estate/EstateBridgeTest.java
Adds the configurable heir wait period, resolves the heir from the deceased character’s saved data, and checks whether the estate permits inheritance. Tests cover lookup and estate-check outcomes.
Apply held-realm inheritance
src/main/java/net/tfminecraft/simplefactions/guild/HeldRealms.java, src/main/java/net/tfminecraft/simplefactions/identity/LeaderCharacterListener.java, src/test/java/net/tfminecraft/simplefactions/guild/HeldRealmsHeirTest.java, src/test/java/net/tfminecraft/simplefactions/guild/HeldRealmsTest.java
Attempts inheritance on character start and during hourly processing. Checks eligibility and the held-week deadline, saves the heir as leader, and restores the held state after a failed save. Tests cover these conditions and retry behaviour.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant LeaderCharacterListener
  participant HeldRealms
  participant WillHeirs
  participant EstateBridge
  LeaderCharacterListener->>HeldRealms: heirStarted(member key, current time)
  HeldRealms->>WillHeirs: Resolve the deceased leader's named heir
  HeldRealms->>EstateBridge: Check estate inheritance eligibility
  HeldRealms->>HeldRealms: Validate conditions and save the heir as leader
Loading

Suggested reviewers: ryanbarlow97

Merge Risk: Minimal · up to b9fd8

No demonstrated issue blocks merging; run the normal checks before release.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Oct 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XxFran10xX
XxFran10xX marked this pull request as ready for review October 24, 2026 21:05
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX
XxFran10xX merged commit ea9a3d2 into main Oct 24, 2026
4 checks passed
@XxFran10xX
XxFran10xX deleted the feat/will-heir-realms branch October 24, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant