Skip to content

feat(jvm)!: host sessions through engine-neutral primitives, split minestom and multistom - #334

Merged
oglassdev merged 11 commits into
mainfrom
feat/session-primitives
Oct 6, 2026
Merged

oglassdev merged 11 commits into
mainfrom
feat/session-primitives

Conversation

@oglassdev

@oglassdev oglassdev commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lets apps bring their own session isolation instead of being bound to the multistom fork.

  • jvm/runtime gains engine-neutral primitives:
    • SessionHandler — the app decides what a session is (create, finish, optional method).
    • SessionControl — reports ready() (returns whether it took effect) / fail() / ended() back to core.
    • SessionMethod — one session method call; handlers call start() right before running effects, which re-checks cancellation, the deadline and the player's delivery.
    • Delivery — a delivered player: arrived(), left() (stops methods, keeps the fence), release(), move(destination), operationId(action).
    • ChunkSessions — the ledger behind ChunkProcess.host(handler): applies jvm/<host> entries, admits players by their chunk:delivery capability, enforces the creation deadline, fences generations, and reports JvmReports.
    • ChunkProcess adds public host, tick, bind(port, protocol) and playerAddress().
  • jvm/minestom (new, artifact com.chunkzero.chunk:minestom): ChunkLogin for upstream net.minestom:minestom. It answers the login request, admits only prepared deliveries with the gateway-authenticated profile, and releases each delivery after the app's leave handler once the connection closes. Spawning, arrival and isolation stay with the app (shared instances, several per session, or max_sessions = 1).
  • jvm/multistom (renamed from jvm/runtime-minestom; runtime-minestom-kotlin is now multistom-kotlin) is rebuilt on top: SessionManager implements SessionHandler, and ProcessService / SessionMethodService are gone.

Behavior changes

  • The multistom runtime moved from com.chunkzero.chunk.runtime to com.chunkzero.chunk.multistom (.assets, .bootstrap, .event, .internal); engine-neutral classes stay in com.chunkzero.chunk.runtime. Generated code (Gradle plugin registries, chunk-build Java codegen and release analysis) targets the new names, so apps need the matching chunk CLI. SessionControl.isReady() and ChunkProcess.app() are now public; ManagedSession.getPhase() is gone.

  • Artifacts renamed: runtime-minestom → multistom, runtime-minestom-kotlin → multistom-kotlin. The version catalog calls the fork libs.multistom and upstream libs.minestom. minestom and multistom are independent; neither depends on the other.

  • ATTACHED is reported at admission rather than when the player reaches PLAY.

  • A session method that its handler completes without calling start() reports CANCELLED; one that fails before starting (e.g. undeclared) reports FAILED.

  • ChunkMinestom's tick notices disconnects (gameplay.flush()) before running queued tick tasks.

  • runtime-minestom-kotlin and runtime tests now build sessions through ChunkSessions.detached(...).

  • jvm/runtime exposes backend-client as api.

Known limitations

  • The Gradle plugin still always adds multistom (the fork) and generates @SessionType registrations, so a chunk project can't opt into upstream Minestom yet. That needs a follow-up.
  • No finish deadline: a session stays ENDING until the handler calls ended(), same as before.

Validation

  • ./gradlew :jvm:runtime:test :jvm:multistom:test :jvm:multistom-kotlin:test :jvm:minestom:test, jvm/gradle-plugin tests
  • examples/local CoinCommandTest
  • just fmt
  • cargo test -p chunk-build (release, codegen); examples/{local,arena,load} testClasses
  • 9 rounds of GPT-6.1 Sol review; the final round was clean.

🤖 Generated with Claude Code

Add SessionHandler, SessionControl, Delivery and ChunkSessions to jvm/runtime so
apps decide what a session is and how it is isolated, and add
jvm/minestom-primitives with ChunkLogin for upstream Minestom. runtime-minestom
now runs on top of these primitives.
… deadlines in sweep

Release a delivery only when player cleanup or leave succeeds, enforce the
session creation deadline from sweep() instead of the common pool, and
publish SessionCreateEvent only when ready() took effect.
Rename runtime-minestom to multistom, runtime-minestom-kotlin to
multistom-kotlin and minestom-primitives to minestom, so each published module
names the Minestom it compiles against. The version catalog now calls the fork
`multistom` and upstream Minestom `minestom`.
@oglassdev oglassdev changed the title feat(jvm)!: host sessions through engine-neutral primitives feat(jvm)!: host sessions through engine-neutral primitives, split minestom and multistom Oct 6, 2026
@oglassdev
oglassdev added this pull request to stack #338 October 6, 2026 03:54
@oglassdev
oglassdev merged commit 3e53f53 into main Oct 6, 2026
22 of 23 checks passed
@oglassdev
oglassdev deleted the feat/session-primitives branch October 12, 2026 23:26
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