pyCraft icon indicating copy to clipboard operation
pyCraft copied to clipboard

See how many players are online in lobby

Open CamronW opened this issue 5 years ago • 2 comments

Hey,

I've been trying to get the number of players in the lobby (server) as the client. I've tried using the playerListItemPacket and adding all the UUID's to a set, which sort of works.

However, the problem I've encountered is that if a server has any NPC's (Using citizens plugin) near the player, they will also be counted. This means that a server with 10 players may show as having 20+ if there's a lot of NPC's.

Is there a way to make it so I'm able to ignore the NPC's on the playerListItemPacket? Or is there another packet I can use that will only show me real players?

Thanks

CamronW avatar Mar 26 '19 13:03 CamronW

Hello. I'm not familiar with this plugin, but it sounds like you might need to rely on a heuristic to guess whether a given player entry is a "citizen" or not. How do you normally tell them apart as a human?

joodicator avatar Mar 26 '19 16:03 joodicator

I note also that it is possible to determine the server's reported number of players by making a separate connection in status query mode.

joodicator avatar Mar 26 '19 16:03 joodicator