Skip to content

fix(lobbyswitcher): report the configured player limit to CloudNet - #416

Merged
TheMeinerLP merged 1 commit into
mainfrom
fix/lobby-max-players
Oct 12, 2026
Merged

TheMeinerLP merged 1 commit into
mainfrom
fix/lobby-max-players

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Root cause

The lobby switcher showed a lobby with 2 players as "Full (2/1)". CloudNet's Minestom bridge (MinestomBridgeManagement) fires a single ServerListPingEvent while the extensions load and stores status.playerInfo().maxPlayers() as the service's Max-Players. That happens during bootstrap.init(), before Titan builds its bean scope, and Titan never set a maximum, so Minestom's default (PlayerInfo.onlineCount() = online, online + 1, i.e. 1 at boot) was stored and never refreshed.

Fix

  • New config lobby.maxPlayers (default 100, must be >= 1, fails startup naming the key) in runtime.yaml.
  • LobbyPlayerLimitAnnouncer reports it in every ServerListPingEvent (online count and description untouched).
  • It also announces the limit through the JDK-only holder TitanPlayerLimit (common). The :bridge extension registers a listener at init, sets BridgeServiceHelper.maxPlayers() and publishes a service info update once Titan announces. No CloudNet patch; only JDK types cross the classloader boundary.
  • The switcher is unchanged (it already treats max <= 0 as unknown).

Tests

  • LobbyPlayerLimitTest: Minestom default is online + 1; ping reports the limit and keeps online/description; limit < 1 is rejected.
  • LobbyPlayerLimitAnnouncerTest: ping reports the limit and the bridge listener hears it.
  • TitanPlayerLimitTest: announce, replay to late listener, clear.
  • ApplicationYamlDefaultsCharacterizationTest: ships 100.
  • check, build and bootSmokeTest pass locally.

Not verified live: the bridge extension's CloudNet calls (no unit test, needs a running CloudNet node).

https://claude.ai/code/session_01GXose9rakuRNZoM3TP3xj1

CloudNet's Minestom bridge fires one ServerListPingEvent while the
extensions load and stores its maximum as the service's Max-Players.
Titan set none, so Minestom's default (online + 1 = 1) was stored and the
switcher showed a lobby with 2 players as full (2/1).

Add lobby.maxPlayers (default 100), report it in every ping and announce
it through a JDK-only holder; the bridge extension applies it to the
bridge service helper and publishes a service info update.

Claude-Session: https://claude.ai/code/session_01GXose9rakuRNZoM3TP3xj1
@TheMeinerLP
TheMeinerLP requested a review from a team as a code owner October 11, 2026 20:18
@github-actions

Copy link
Copy Markdown
Contributor

Test results

  876 files    876 suites   51m 22s ⏱️
2 365 tests 2 363 ✅  2 💤 0 ❌
7 123 runs  7 040 ✅ 83 💤 0 ❌

Results for commit c986126.

@TheMeinerLP
TheMeinerLP merged commit ff6da98 into main Oct 12, 2026
8 checks passed
@TheMeinerLP
TheMeinerLP deleted the fix/lobby-max-players branch October 12, 2026 19:19
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