Skip to content

Support server-owned vehicles (VF 2.20.0) - #248

Merged
Drefvelin merged 2 commits into
mainfrom
feat/server-owned-vehicles
Nov 15, 2026
Merged

Drefvelin merged 2 commits into
mainfrom
feat/server-owned-vehicles

Conversation

@Drefvelin

Copy link
Copy Markdown
Contributor

Summary

Supports server-owned vehicles from VehicleFramework v2.20.0 (/vf server, VF PR #95). A server vehicle has no player owner, no payer and no upkeep. SimpleFactions now treats it that way.

Conversion

  • When /vf server changes ownership (reason SERVER), the gate releases the vehicle through the normal forgetOwner path: the payer row is dropped and the change is audited.
  • On top of that, server conversion only clears:
    • pending offers and upkeep requests
    • fee prompts
    • unpaid maintenance
    • faction click modes
  • Paid fee receipts are left untouched, never refunded. A normal release still keeps unpaid maintenance debt, so releasing a vehicle cannot be used to dodge it.
  • A STAFF_VEHICLE_SERVER log line records the staff member, the vehicle, the previous owner and the previous mode.
  • Taking a server vehicle back with /vf takeover uses the normal takeover path and restores a payer.

Battles

  • The upkeep-only check is skipped for server vehicles.
  • In a campaign battle, a server vehicle can be used by:
    • the side it is forced to with the forced-vehicle tool, or
    • anyone, when all vehicles are usable.
  • Otherwise it is denied with "Staff have not assigned this server vehicle to a side in this battle."
  • Warband blocks still apply.
  • ServerVehicleUseListener answers VF's ServerVehicleUseEvent with these rules. It is the only class that references the event. It is registered only after Class.forName finds the event, so SF still loads on older VF.

Audit

These flows skip server vehicles:

  • release, transfer and handover
  • maintenance pay and repair
  • upkeep
  • the edit-check and pre-interact gates

The reconcile reports a server vehicle that still has a payer row.

Other

  • vehicleframework.version is now 2.20.0.
  • OwnerTags.SERVER and VehicleRemovals.isServer were added.
  • The README documents the battle rule.

Tests

  • New: ServerVehicleAuditTest and ServerVehicleUseTest.
  • Extended: the gate and reconcile tests.
  • mvn verify passes with 100% line coverage.

🤖 Generated with Claude Code

Server conversion releases the payer and clears pending offers, upkeep
requests, fee prompts, unpaid maintenance and click modes. Fee, upkeep,
handover and transfer flows skip server vehicles. In campaign battles a
server vehicle is usable only by the forced side or when all vehicles are
usable. The ServerVehicleUseEvent listener is registered only when VF has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Nov 14, 2026
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • Added server-owned vehicles with no personal faction payer or upkeep. Staff can convert vehicles to server ownership or restore personal ownership.
    • In campaign battles, server vehicles are available to the assigned side unless all vehicles are permitted. Outside campaign battles, existing vehicle permissions apply.
  • Bug Fixes
    • Server-owned vehicles no longer trigger personal ownership, transfer, upkeep or repair handling. Converting a vehicle clears associated payer records and pending requests.
    • Vehicle-specific cleanup leaves unrelated requests and fee confirmations unchanged.
  • Tests
    • Added coverage for server vehicle access, ownership changes and cleanup.

The change adds server-owned vehicle handling, clears related ownership and upkeep state, and applies campaign battle eligibility rules to server vehicle use. It also registers optional VehicleFramework event handling and documents the ownership and use rules.

Changes: Server-owned vehicle support

Layer / File(s) Summary
Server ownership and cleanup
OwnerTags.java, VehicleRemovals.java, VehicleOwnershipGate.java, RequestManager.java, VehicleFeeConfirmations.java, VehicleUpkeepReconcile.java, VehicleOwnershipGateTest.java, VehicleUpkeepReconcileTest.java
A server owner tag identifies server-owned vehicles. Converting a vehicle clears related payer, owner-history, request, fee-confirmation, and unpaid-maintenance state. Reconciliation reports stale payer rows. Tests cover conversion, takeover, and reconciliation.
Server vehicle interaction exclusions
VehicleOwnershipGate.java, vehicles/berth/*, vehicles/handover/*, vehicles/maintenance/*, vehicles/upkeep/*, ServerVehicleAuditTest.java, ConfigLoaderBattleScheduleTest.java
Ownership, transfer, release, handover, upkeep, and maintenance listeners skip server-owned vehicles. Tests cover listener behaviour, vehicle-specific cleanup, and restoration of static cache values between battle schedule tests.
Campaign battle use and event integration
BattleVehicleEligibilityService.java, ServerVehicleUseListener.java, ServerVehicleUseRegistration.java, SimpleFactions.java, pom.xml, README.md, ServerVehicleUseTest.java
Campaign battle rules determine when players may use server vehicles. Optional VehicleFramework event registration connects those rules to server vehicle use. The README describes the ownership and use rules.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ServerVehicleUseEvent
  participant ServerVehicleUseListener
  participant BattleVehicleEligibilityService
  ServerVehicleUseEvent->>ServerVehicleUseListener: Dispatch use event
  ServerVehicleUseListener->>BattleVehicleEligibilityService: Check mayUseServer(player, vehicle)
  BattleVehicleEligibilityService-->>ServerVehicleUseListener: Return eligibility
  ServerVehicleUseListener->>ServerVehicleUseEvent: Allow event when eligible
Loading

Suggested reviewers: ryanbarlow97, xxfran10xx

Merge Risk: Minimal · up to 41ceb

This change adds server-owned vehicle support, with matching cleanup, interaction exclusions and campaign-battle usage rules. Tests cover the new behavior and I found no actionable merge-blocking risk.

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

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: 39d99c70-d028-464f-bdd3-eff35dbf5453
Commits

Reviewing files that changed from the base of the PR and between 51f41c4 and 41ceb19.

Files selected for processing: 1

  • src/test/java/net/tfminecraft/simplefactions/loaders/ConfigLoaderBattleScheduleTest.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.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 14, 2026
ConfigLoaderBattleScheduleTest loads configs that set static Cache fields
such as warAvailabilityTimeLockHours=12 and never put them back, so war
schedule tests that ran after it computed time locks from the wrong
settings. Main's build has failed on this since 2026-11-14.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Drefvelin
Drefvelin merged commit d098379 into main Nov 15, 2026
3 checks passed
@Drefvelin
Drefvelin deleted the feat/server-owned-vehicles branch November 15, 2026 09:27
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.

2 participants