Closed roccodev closed 7 years ago
When are you calling the method? You should only call it when you know that the player is already connected to the server and inside a world.
Oh, I was running it in a ServerConnectEvent listener, maybe I should delay it.
Yeah, during the connect event the client doesn't have any information about the player list. You could try to use the TickEvent
and call the getServerPlayers()
function as soon as ModAPI#isInWorld()
returns true
.
ModAPI#getServerPlayers() returns an error saying "This method can only be called in a world!"