Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved Players.getLocal() threw NPE

Joined
Feb 18, 2017
Messages
176
I read in the jdocs:

static Player getLocal()
Gets the local player, also known as your character.

Then I used it and a user got NPE.
Am I wrong to assume that the player will be automatically logged in before onStart is called for a LoopingBot?
 
Java Warlord
Joined
Nov 17, 2014
Messages
4,906
There pretty much is not a single type of game entity that is always loaded, including the local player. Just nullcheck everything you get from the game.

Edit: The local player may even be null if you are logged in, just fyi.
 
Top