Skip to content

Add opt-in factions.clearHomeOnChunkLoss - #2232

Merged
dmccoystephenson merged 2 commits into
mainfrom
feature/clear-home-on-chunk-loss
Nov 22, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feature/clear-home-on-chunk-loss

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

A server operator's feedback suggested that a faction's home should not survive losing the land it stands on. Today the home stays where it was set even after its chunk is unclaimed or taken in a war. With factions.respawnAtFactionHome on, that lets a defeated faction keep respawning inside territory the winner now holds.

Change

  • New option factions.clearHomeOnChunkLoss, off by default. The code-side fallback is also false, so existing servers see no change.
  • When it is on, the home is removed as soon as the faction stops holding the chunk the home is in. The check sits in MfClaimService so every path is covered:
    • delete: /f unclaim (single and radius) and autounclaim
    • deleteAllClaims: /f unclaimall
    • save: when the chunk passes to another faction (conquest or overclaim). Re-saving a claim for the same faction leaves the home alone.
  • Disbanding calls a new internal overload, deleteAllClaims(id, clearHome = false), so the disband path does not save the faction it is about to delete. The public deleteAllClaims(MfFactionId) and its @JvmName are unchanged.
  • The home is cleared through MfFactionService.update, the same retry-on-conflict path other faction edits use, so the jOOQ and JSON backends both get the change. Only the home field changes, and no storage or migration change is needed.
  • Members are told with a new notification, FactionHomeClearedOnChunkLossNotificationTitle/Body, added to all five lang files in each file's own encoding. ./check-lang-encoding.sh passes.
  • Docs: CONFIG.md, FAQ.md, USER_GUIDE.md and CHANGELOG.md (Unreleased → Added).

Tests

MfClaimServiceClearHomeTest has 9 tests: option off; own unclaim; another faction taking the chunk; same-faction re-save; unclaim-all; disband path; a chunk without the home; the same chunk coordinates in another world; and negative block coordinates landing in the right chunk. These 9 and the 22 existing MfClaimService* tests pass locally, and lintKotlin is clean. This change has not been tried in game.

The four disband tests in MfFactionServiceTest stubbed and verified deleteAllClaims(id). Disband now calls deleteAllClaims(id, false), so those stubs and verifications were moved to it, with their assertions unchanged. The full suite passes locally on the rebased head: 1618 tests, 0 failures, lintKotlin clean and ./check-lang-encoding.sh clean.

Java API: the public deleteAllClaims(MfFactionId) keeps @JvmName("deleteAllClaimsByFactionId") and its JVM signature, so add-ons such as Fiefs keep linking. The new two-argument overload is internal.


drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

https://claude.ai/code/session_01LYNeuncv2d9VZ6EKG3yU6d

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Behaviour check: no change

All 120 rows behave as in v11.1.1.

All 106 rows with a reviewed expectation match the documentation they cite.

Run · rows from Dans-Plugins/plugin-fixtures · advisory, not a required check

dmccoystephenson and others added 2 commits November 21, 2026 20:38
When on, a faction's home is removed as soon as the faction stops holding
the chunk it is in: unclaimed (single, radius, autounclaim, unclaimall)
or claimed over by another faction. The check sits in MfClaimService
save/delete/deleteAllClaims, so every path is covered; disbanding passes
clearHome = false. The home is cleared through MfFactionService.update,
so both storage backends are covered, and members are notified with a
new lang key. Off by default, with the code-side fallback matching, so
existing servers see no change.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuncv2d9VZ6EKG3yU6d
MfFactionService.delete removes claims with deleteAllClaims(id, clearHome = false)
so a faction being disbanded is never saved first. The four disband tests
stubbed and verified the one-argument overload, which delete no longer calls;
they now target the two-argument one. Their assertions are unchanged.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuncv2d9VZ6EKG3yU6d
@dmccoystephenson
dmccoystephenson force-pushed the feature/clear-home-on-chunk-loss branch from 9807816 to ebb914d Compare November 22, 2026 03:43
@dmccoystephenson
dmccoystephenson merged commit a9393c4 into main Nov 22, 2026
45 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/clear-home-on-chunk-loss branch November 22, 2026 03:56
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