Minecraft / Bungeecord Plugin] Find out the number of players in a subserver?

Sn
- in Plugins
2

I'm writing a BungeeCord plugin that always sends the player to the server that has the least amount of players. So if, for example, On lobby 1 players play 30 players, but on lobby 2 only 20, players entering the network are expected to land on lobby 2 as there are fewer players. So the question is: how do I get the number of players on a "lower server", like Lobby 2 out? Again: I do not write a plugin for a spigot server, but for the BungeeCord server itself!

Mi

I think you can get the ServerInfo from the server and then just:

ServerInfo info = ProxyServer.getInstance (). GetServerInfo ("name");
int player = info.getPlayers (). Size ();

Sn

Thank you!