Arena session policies
ArenaSessionPolicies is the arena-flow SessionPolicy factory. The three built-ins — hub(), lobbyOfInstance(), gameOfInstance() — dereference HubManager and InstanceManager directly, which is why they live in conduit-arena rather than core. Mods that register a Game via GameRegistry typically pair the registration with a session-policy registration so reconnecting players land in the right place.
When to use it
Section titled “When to use it”- Your game uses the arena pool and you want reconnecting players routed to their lobby or in-game instance.
- You want different routing per phase (lobby = lobby-of-instance, in-game = game-of-instance, celebration = hub).
- You need a sensible fallback when the player’s instance is gone (released, server restart).
package me.zlex.conduit.player;
public final class ArenaSessionPolicies { /** Route to the engine hub spawn point. */ public static SessionPolicy hub();
/** Route to the lobby-staging area of the player's pre-disconnect instance. * Falls back to {@link #hub} if the instance is no longer alive. */ public static SessionPolicy lobbyOfInstance();
/** Route to the in-game area of the player's pre-disconnect instance. * Same as lobbyOfInstance in v1. Wrap a custom policy for finer routing. */ public static SessionPolicy gameOfInstance();}Example
Section titled “Example”import me.zlex.conduit.game.Game;import me.zlex.conduit.game.GameRegistry;import me.zlex.conduit.player.ArenaSessionPolicies;import me.zlex.conduit.player.PlayerSessionManager;
public final class MyMod implements ModInitializer {
@Override public void onInitialize() { Game game = Game.builder("my-game", "My Game").build(); GameRegistry.register(game);
PlayerSessionManager.init(); PlayerSessionManager.registerGame(game.id(), ArenaSessionPolicies.lobbyOfInstance()); PlayerSessionManager.setPhasePolicyOverride(game.id(), "IN_GAME", ArenaSessionPolicies.gameOfInstance()); PlayerSessionManager.setPhasePolicyOverride(game.id(), "CELEBRATION", ArenaSessionPolicies.hub()); }}gameOfInstanceis intentionally the same aslobbyOfInstancein v1 — both point at the instance’s shared-spawn position. Mods that distinguish staging from in-game wrap a custom policy that inspectsSessionRecord.phaseName().- The fallback chain is automatic: if the instance slot has been released,
lobbyOfInstanceandgameOfInstanceboth delegate tohub(). HubManager.getSpawnPoint()is the destination forhub(). Move the hub spawn at runtime if you need a different fallback location.