| Modifier and Type | Class and Description |
|---|---|
static class |
TS3Query.FloodRate
Artificial delay between sending commands, measured in milliseconds.
|
static class |
TS3Query.Protocol
The protocol used to communicate with the TeamSpeak3 server.
|
| Constructor and Description |
|---|
TS3Query()
Creates a TS3Query that connects to a TS3 server at
localhost:10011 using default settings. |
TS3Query(TS3Config config)
Creates a customized TS3Query that connects to a server
specified by
config. |
| Modifier and Type | Method and Description |
|---|---|
void |
connect()
Tries to establish a connection to the TeamSpeak3 server.
|
void |
exit()
Disconnects the query and closes all open resources.
|
TS3Api |
getApi()
Gets the API object that can be used to send commands to the TS3 server.
|
TS3ApiAsync |
getAsyncApi()
Gets the asynchronous API object that can be used to send commands to the TS3 server
in a non-blocking manner.
|
boolean |
isConnected()
Returns
true if the query is likely connected,
false if the query is disconnected or currently trying to reconnect. |
public TS3Query()
localhost:10011 using default settings.public void connect()
IllegalStateException - if this method was called from ConnectionHandler.onConnect(com.github.theholywaffle.teamspeak3.TS3Api)TS3ConnectionFailedException - if the query can't connect to the server or the ConnectionHandler throws an exceptionpublic void exit()
If the command queue still contains commands when this method is called, the query will first process these commands, causing this method to block. However, the query will reject any new commands as soon as this method is called.
IllegalStateException - if this method was called from ConnectionHandler.onConnect(com.github.theholywaffle.teamspeak3.TS3Api)public boolean isConnected()
true if the query is likely connected,
false if the query is disconnected or currently trying to reconnect.
Note that the only way to really determine whether the query is connected or not
is to send a command and check whether it succeeds.
Thus this method could return true almost a minute after the connection
has been lost, when the last keep-alive command was sent.
Please do not use this method to write your own connection handler.
Instead, use the built-in classes in the api.reconnect package.
TS3Config.setReconnectStrategy(ReconnectStrategy),
TS3Config.setConnectionHandler(ConnectionHandler)public TS3Api getApi()
TS3Api objectpublic TS3ApiAsync getAsyncApi()
Please only use the asynchronous API if it is really necessary and if you understand the implications of having multiple threads interact with your program.
TS3ApiAsync objectReleased under the MIT license.