Skip to content

feat: staff commands to add characters to guilds, companies, warbands and coalitions - #201

Merged
XxFran10xX merged 4 commits into
mainfrom
feat/staff-membership-commands
Oct 21, 2026
Merged

XxFran10xX merged 4 commits into
mainfrom
feat/staff-membership-commands

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Staff could already force a character into a faction (/faction forcejoin) and a faction into a movement (/movement admin join), but not into anything else. This adds the missing staff "add" commands:

Command Permission Adds
/guild forcejoin <guild> <character> simplefactions.admin a character to a (non-base) guild
/company admin add <company> <character> simplefactions.admin a character to a mercenary company
/warband forcejoin <warband> <character> warbands.admin a character to a warband
/coalition admin add <faction> <coalition> simplefactions.admin a faction to a coalition

Each one skips the invite and nothing else; every other joining rule still applies:

  • Guild: the character must be in no faction, or in the base guild of that guild's own faction; the faction leader can't join; refused while the realm is closing. Other guild members and the character are told.
  • Company: the character needs the mercenary trait and a free slot, and must not already serve in a company. The company tick would drop anyone without the trait, so staff can't bypass it. Refusals are worded for staff.
  • Warband: goes through the normal signup checks (raid signup windows, sides, vehicles, faction warbands need a faction), so it persists and binds sides exactly as a normal join does.
  • Coalition: CoalitionService.join now shares its rules with adminAdd; the only difference is the invite.

Characters are named the same way as /faction forcejoin: online character or Minecraft name, or a character ID. A character ID must name a living character. Names with spaces work. All four complete in tab completion.

Testing

  • Unit tests for StaffJoins, the four command routes, their tab completion and CoalitionService.adminAdd. Every changed class is at 100% line coverage locally.
  • On TFMCDev01 with mineflayer bots (TestChar1 as staff, TestChar2 as target), all 29 checks passed: no-permission refusals; guild add by multi-word character name, plus base-guild, other-realm, unknown-character, unknown-guild and already-a-member refusals; company full/enlist/already-serving; warband add/already-in; coalition usage and no-coalition refusal; tab completion for each; no SimpleFactions errors in the log. Dev testing found that staff got the player-facing "You are not the sort to take mercenary work." line, now fixed in the second commit.
  • Dev has no coalitions, so the coalition add path itself is covered by unit tests only.

🤖 Generated with Claude Code

XxFran10xX and others added 3 commits October 21, 2026 11:22
… and coalitions

/guild forcejoin <guild> <character>, /company admin add <company> <character>,
/warband forcejoin <warband> <character> and /coalition admin add <faction>
<coalition> skip the invite but keep every other joining rule. Typed character
IDs must name a living character.

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

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dee82794-ccf2-4047-973d-a36bda26b07b

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: aae439bb-b2a1-4d1b-95f1-65fb8c5baff7
📥 Commits

Reviewing files that changed from the base of the PR and between 81bca3b and 6ddc116.

📒 Files selected for processing: 16
  • src/main/java/net/tfminecraft/simplefactions/diplomacy/coalition/CoalitionService.java
  • src/main/java/net/tfminecraft/simplefactions/managers/CoalitionCommandManager.java
  • src/main/java/net/tfminecraft/simplefactions/managers/CoalitionTabCompletion.java
  • src/main/java/net/tfminecraft/simplefactions/managers/CommandManager.java
  • src/main/java/net/tfminecraft/simplefactions/managers/MercenaryCommandManager.java
  • src/main/java/net/tfminecraft/simplefactions/managers/StaffJoins.java
  • src/main/java/net/tfminecraft/simplefactions/utils/TabCompletion.java
  • src/main/java/net/tfminecraft/simplefactions/war/battle/ui/BattleCommandManager.java
  • src/main/java/net/tfminecraft/simplefactions/war/battle/ui/BattleTabCompletion.java
  • src/test/java/net/tfminecraft/simplefactions/diplomacy/coalition/CoalitionCommandTest.java
  • src/test/java/net/tfminecraft/simplefactions/diplomacy/coalition/CoalitionServiceTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/CommandManagerCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/MercenaryCommandsCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/StaffJoinsTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/TabCompletionCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/war/battle/ui/BattleCommandsCoverageTest.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
    • Staff can add factions to coalitions through the admin command.
    • Added staff-only force-join commands for guilds and warbands.
    • Company administrators can add characters directly to a company.
    • New validation ensures eligibility, membership, leadership, and capacity rules remain enforced.
    • Added relevant success, error, and notification messages.
  • Usability
    • Tab completion now suggests applicable coalitions, guilds, companies, warbands, and eligible online characters for the new commands.
  • Tests
    • Added coverage for successful operations, permissions, validation failures, notifications, and completion suggestions.

Staff can add factions to coalitions and directly join characters to guilds, mercenary companies, and warbands. The changes add admin commands, eligibility checks, tab completion, and tests for these operations.

Changes: Coalition administration

Layer / File(s) Summary
Coalition admission and admin command
src/main/java/net/tfminecraft/simplefactions/diplomacy/coalition/CoalitionService.java, src/main/java/net/tfminecraft/simplefactions/managers/CoalitionCommandManager.java, src/main/java/net/tfminecraft/simplefactions/managers/CoalitionTabCompletion.java, src/test/java/net/tfminecraft/simplefactions/diplomacy/coalition/*
The service shares admission checks between normal and staff joins. The admin command adds factions and reports the result. Tab completion and tests cover faction suggestions and successful addition.

Staff character joins

Layer / File(s) Summary
Staff join rules and validation
src/main/java/net/tfminecraft/simplefactions/managers/StaffJoins.java, src/test/java/net/tfminecraft/simplefactions/managers/StaffJoinsTest.java
StaffJoins resolves online living characters and checks guild, company, and warband eligibility. Successful joins update membership or invoke the relevant service and send notifications. Tests cover rejection and success cases.
Staff join command entry points
src/main/java/net/tfminecraft/simplefactions/managers/CommandManager.java, src/main/java/net/tfminecraft/simplefactions/managers/MercenaryCommandManager.java, src/main/java/net/tfminecraft/simplefactions/war/battle/ui/BattleCommandManager.java, src/test/java/net/tfminecraft/simplefactions/managers/CommandManagerCoverageTest.java, src/test/java/net/tfminecraft/simplefactions/managers/MercenaryCommandsCoverageTest.java, src/test/java/net/tfminecraft/simplefactions/war/battle/ui/BattleCommandsCoverageTest.java
Admin commands delegate guild, company, and warband character joins to StaffJoins. Tests cover authorisation, invalid targets, and command results.
Staff join tab completion
src/main/java/net/tfminecraft/simplefactions/utils/TabCompletion.java, src/main/java/net/tfminecraft/simplefactions/war/battle/ui/BattleTabCompletion.java, src/test/java/net/tfminecraft/simplefactions/managers/TabCompletionCoverageTest.java, src/test/java/net/tfminecraft/simplefactions/war/battle/ui/BattleCommandsCoverageTest.java
Completion suggests guild, company, and warband targets and eligible online characters. Tests cover filtering, permissions, and multi-word character names.

Priority: ⚪ Pending latest changes

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant CommandManager
  participant StaffJoins
  participant Guild
  Admin->>CommandManager: request guild forcejoin
  CommandManager->>StaffJoins: guild(guild, character name)
  StaffJoins->>Guild: update membership after checks
  StaffJoins-->>CommandManager: return result message
  CommandManager-->>Admin: send result
Loading

Suggested reviewers: drefvelin, ryanbarlow97

Merge Risk: ⚪ Minimal · up to 6ddc1

No actionable issue remains from the examined membership paths; the PR is mergeable after normal checks.

- [ ] 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.

@coderabbitai

coderabbitai Bot commented Oct 21, 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.

…does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XxFran10xX
XxFran10xX merged commit 84704b8 into main Oct 21, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the feat/staff-membership-commands branch October 21, 2026 10: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