bot.players not returning all connected players on paperMC servers #3608
Labels
possible bug
Stage1
just created by someone new to the project, we don't know yet if it deserves an implementation / a f
Uh oh!
There was an error while loading. Please reload this page.
Versions
Detailed description of a problem
My bot connects to a server with 5 people online. When I log the result of bot.players the only player that it finds is the bot itself. It will only find another player if they connected AFTER the bot did. So to show up to the bot, you must reconnect first.
What did you try yet?
I tried instead using bot.entities and filtering out everything except players like this:
But it gives me the same result, it only lists one player: the bot. I made sure there was at least one other person in the vicinity of the bot but still they never show up unless they reconnect. I am not sure what else to try other than to verify that it works on a server running spigot, which indeed it does work.
Your current code
Expected behavior
I expect to see a list of the connected players like so:
Player1,Player2,Player3,etc.
When I connect to a server running spigot that's what I get, however on the server I play on, which is running paper, the only player I see in the output is the bot unless another player connects/reconnects
Workaround
I managed to find a workaround. bot.entities was still coming up with players' uuids, so I just resolved the player names through the mojang api and then updated the playerlist.
And then:
The text was updated successfully, but these errors were encountered: