Repository navigation
Record the constructor's character beside the account - #31
Conversation
The character session API in TLibs is main-thread only, so VFBuilders no longer claims Folia support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
constructorUuid stays the account. Each build now also records constructorCharacterId, the player's current character session when the build starts (null without one, or when TLibs lacks the session API). The station saves it, older saves load with null, and the begin, construct and cancel events expose it as getConstructorCharacterId(). ConstructionFreeze gains a default freezeReason(account, character) that asks the account form; stations call the two-argument form each second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
|
Muse (independent reviewer) reviewed this PR after merge, against the stage 6a design: verdict OK. One minor note: if a character provider threw from |
Stage 6a, VFBuilders part: constructor credit becomes character-aware without changing what
constructorUuidmeans.What changes
constructorUuidstays the account. Each build also recordsconstructorCharacterId, taken fromCharacters.currentSession(p).filter(Characters::isCurrent)when the build starts (StationManager.onPlayerLeftClick), beforeBeginVehicleConstructionEventfires. The same value goes on the event and the station.constructorCharacterIdindata/stations.json. Saves written before this change have no field and load with a null character. VFBuilders does not resolve heirs; SimpleFactions does.BeginVehicleConstructionEvent,VehicleConstructEventandVehicleConstructionCancelEventexposeUUID getConstructorCharacterId(). The old constructors remain and pass a null character, so existing callers and tests compile unchanged.ConstructionFreezegainsdefault String freezeReason(UUID account, UUID character), which asks the existing account method.ConstructionFreezes.reason(account, character)calls it, and stations use it every second. An account-only provider (today's SimpleFactions) behaves exactly as before.Class.forName/getMethod, catchingReflectiveOperationException | LinkageError). On an older TLibs, builds record no character instead of failing.folia-supportedis removed fromplugin.yml, because the Characters API is main-thread only.Probing from SimpleFactions
The same accessor exists on
BeginVehicleConstructionEventandVehicleConstructionCancelEvent. A test asserts these signatures.Validation
tfmc-mvn -o -B clean verify: 40 tests, 0 failures. JaCoCo 100% of instructions (3992/3992), branches (412/412) and lines (950/950). Installed locally as 2.2.0 (vfbuilders-2.2.0.jarSHA-25683b8d0f49c2555044bd4b0cc5311b4e6f2fad834c3684e1621d6ea8224a00b0b). CI may 404 until TLibs 2.4.1 is available to the pinned installer; that is expected before release.New tests cover the persistence round trip (including a save in the old format without the field, and an invalid character id), the character on all three events, freeze delegation from the two-argument form to account-only providers, the station asking freezes with both ids, capture at build start with a current, stale and missing session, and the probe on an older TLibs.
Docs: TF-Minecraft/Docs#206
Not merged, released or deployed. Release order for the set: TLibs, RPCharacters, VehicleFramework, VFBuilders, Thievery, SimpleFactions.
🤖 Generated with Claude Code