TheHolyWaffle / TeamSpeak-3-Java-API

A Java wrapper of TeamSpeak's 3 server query API.
MIT License
306 stars 107 forks source link

ClientDatabaseID and ClientID from ClientLeave #368

Closed CheeseTastisch closed 4 years ago

CheeseTastisch commented 4 years ago

Hey,

can i get the clientDatabaseID and the clientID from the ClientLeave event and how?

TAXSET commented 4 years ago

You can get the client Id by using clientLeaveEvent.getClientId().

CheeseTastisch commented 4 years ago

And clientDatabaseID?

TAXSET commented 4 years ago

You could get the database id by client id, but I'm not sure if that'll still work after the client has closed connection to the server.

Has been quite a while since I last worked with the API.

CheeseTastisch commented 4 years ago

Hey, i can get the ClientID. But if i wound get a Client via the ClientID, ther is this Error:

[Proxy-1]com.github.theholywaffle.teamspeak3.api.exception.TS3CommandFailedException: A "clientinfo" command returned with a server error. [Proxy-1]>> invalid clientID (ID 512) [Proxy-1] at com.github.theholywaffle.teamspeak3.api.CommandFuture.getUninterruptibly(CommandFuture.java:357) ~[?:?] [Proxy-1] at com.github.theholywaffle.teamspeak3.api.CommandFuture.checkForFailure(CommandFuture.java:416) ~[?:?] [Proxy-1] at com.github.theholywaffle.teamspeak3.TS3Api.getClientInfo(TS3Api.java:1945) ~[?:?] [Proxy-1] at me.cheesetastisch.teamspeak.listener.CacheAndSetup.onClientLeave(CacheAndSetup.java:79) ~[?:?] [Proxy-1] at com.github.theholywaffle.teamspeak3.api.event.ClientLeaveEvent.fire(ClientLeaveEvent.java:51) ~[?:?] [Proxy-1] at com.github.theholywaffle.teamspeak3.EventManager$ListenerTask.run(EventManager.java:150) ~[?:?] [Proxy-1] at com.github.theholywaffle.teamspeak3.TS3Query.lambda$submitUserTask$0(TS3Query.java:282) ~[?:?] [Proxy-1] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_252] [Proxy-1] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_252] [Proxy-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_252] [Proxy-1] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_252] [Proxy-1] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]

Any other Idees?

TAXSET commented 4 years ago

Yeah, that's because the client is no longer connected to the server. The Teamspeak Query unfortunately can not return information about a client that is not online. You'd have to cache the info you need yourself (eg. by adding entries to an array which holds all the info you need using the ClientJoinEvent).

CheeseTastisch commented 4 years ago

Thanks for your answer, i have now created an cache, witch caches the ClientID and the ClientDatabaseID. Whit this info i can develop the other stuff i woud do.

Sorry for my bad Englich, i am from Germany...