Reconnect to the Saturn server and time out requests

Move to session-java 0.2.0 (Gitea package registry) and rework
ServiceClient around a single connect loop:

- Reconnect with exponential backoff (1 s -> 60 s) when the connection
  drops, e.g. on every server redeploy; give up only when retrying cannot
  help (no Minecraft session, or the server rejects the token)
- Publish the session only after authentication succeeds, and replace
  (rather than append to) owned cosmetics and clear cached players on
  reconnect
- Time out every request after 10 s and connecting after 10 s, so a lost
  response can no longer hang the player-lookup worker forever
- Register onClientStopping once, and keep a local session reference in
  request callbacks
- Allow -Dsaturn.serverUri to point the client at a local server

Refs saturnclientmc/saturnclient#4, saturnclientmc/saturnclient#5

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-09-25 14:46:30 +02:00
co-authored by claude
parent 8cb458c9bd
commit 3b4e1ab4cb
3 changed files with 245 additions and 166 deletions
@@ -78,6 +78,12 @@ public class SaturnPlayer {
return get(name, Providers.saturn.getClient().getPlayerListEntryUUID(name));
}
/** Forgets every cached player, e.g. after reconnecting to the server. */
public static void clear() {
PLAYERS.clear();
NEXT_LOOKUP.clear();
}
public static void set(SaturnPlayer player) {
PLAYERS.put(player.uuid, player);
NEXT_LOOKUP.remove(player.uuid);