TeamSpeak-3-Java-API
TeamSpeak-3-Java-API copied to clipboard
NullPointerException at .registerAllEvents()
Hello, when i load allEvents(".registerAllEvents()") i become a NullPointerException in my events class.
This the error:
Why is it so?
Thanks for helping
Hi @SaftigeOrange
Could you please share the stack trace of the exception you're getting with us?
Also, it seems very suspicious that you're creating two instances of your TeamSpeakService
. Are you sure you didn't mean to re-use the first TeamSpeakService
?
That would explain why you, judging from the initial title, were getting an exception while trying to set your nickname. Nicknames on a TS3 server must be unique, so if you use a nickname that's already in use - as you would if you had 2 queries connecting to the same server and trying to use the same nickname - the command will fail and you'll get an exception.