Skip to content

feat(velocity): show the network-wide player count - #43

Merged
TheMeinerLP merged 1 commit into
mainfrom
feat/v2-network-count
Nov 25, 2026
Merged

TheMeinerLP merged 1 commit into
mainfrom
feat/v2-network-count

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Problem

Players see the online count in the server list when they add or refresh a server. With several proxies, each proxy only counted its own players, so the number people saw was far below what was actually online on the network.

Approach

The Velocity plugin now keeps a copy of the network-wide player count. It loads the count when it connects and after a resync, and updates it from the controller's network.players events. When the server list is pinged, the plugin shows the larger of the network total and the proxy's own count. The maximum stays as Velocity reports it. If the controller does not offer the count yet (404 from an older controller), the proxy falls back to its own count and keeps working.

The proxy's own player count was already reported to the controller, so no change was needed there.

To check that a proxy can reach its game servers without a client joining, the plugin now pings each backend server once after registering it and logs the result, either the version and player count or the reason it failed.

Testing

  • SDK: unit tests for parsing the network count from the endpoint and the event, including the 404 case and server errors.
  • Velocity: unit tests for the count logic, the ping log lines, and that a registered server is pinged exactly once.
  • heavy ./gradlew --max-workers=2 :grus-sdk:test :grus-velocity:test passes.

Not covered here: the controller endpoint GET /v1/network and the network.players event are not on main yet. Until they land, the plugin shows its own count as before.

The server list showed only this proxy's players, so a player on one
proxy saw a much smaller number than the network really had. The plugin
now fetches the network count on connect and after every resync, keeps
it up to date from network.players events, and shows the larger of that
total and the local count in the ping. The maximum stays as Velocity
has it.

The SDK reads GET /v1/network and the network.players payload. An
older controller that answers 404 is treated as "no count yet", so the
proxy falls back to its local count instead of failing.

Each backend server is pinged once after it is registered and the result
is logged, which shows that the proxy can reach the server without a
game client.
@TheMeinerLP
TheMeinerLP merged commit ad0369d into main Nov 25, 2026
5 checks passed
@TheMeinerLP
TheMeinerLP deleted the feat/v2-network-count branch November 25, 2026 09:29
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