An Java 7 implementation of TeamSpeak's 3 server query API.
- Documented source
- Contains all server query functionality! (see TeamSpeak 3 Server Query Manual)
- Built-in keep alive method
- Threaded event-based system
- No extra libraries
-
Option 1 (Standalone Jar):
Download the latest release and add it to the buildpath of your project.
-
Option 2 (Maven):
Add the following to your pom.xml
<project>
<!-- other settings -->
<repositories>
<repository>
<id>TeamSpeak-3-Java-API-mvn-repo</id>
<url>https://raw.githubusercontent.com/TheHolyWaffle/TeamSpeak-3-Java-API/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.theholywaffle</groupId>
<artifactId>teamspeak3-api</artifactId>
<version>[1.0.0,2.0.0)</version>
</dependency>
</dependencies>
</project>
All functionality is contained in the TS3Api object.
- Create a TS3Config object and customize it.
- Create a TS3Query object with your TS3Config as argument.
- Call
TS3Query#connect()
to connect to the server. - Call
TS3Query#getApi()
to get an TS3Api object. - Do whatever you want with this api :)
final TS3Config config = new TS3Config();
config.setHost("77.77.77.77");
config.setDebugLevel(Level.ALL);
config.setLoginCredentials("serveradmin", "serveradminpassword");
final TS3Query query = new TS3Query(config);
query.connect();
final TS3Api api = query.getApi();
api.selectVirtualServerById(1);
api.setNickname("PutPutBot");
api.sendChannelMessage("PutPutBot is online!");
...
Only use FloodRate.UNLIMITED
if you are sure that your query account is whitelisted. If not, use FloodRate.DEFAULT
. The server will temporarily ban your account if you send too many commands in a short period of time. For more info on this check TeamSpeak 3 Server Query Manual, page 6.
Option | Description | Default value | Required |
---|---|---|---|
Host/IP | IP/Host of TeamSpeak 3 server. | yes | |
QueryPort | Query port of TeamSpeak 3 server. | 10011 | yes |
FloodRate | Prevents possible spam to the server. | FloodRate.DEFAULT |
no |
Username | Username of your query account. | no | |
Password | Password of your query account. | no | |
DebugLevel | Determines how much will be logged. | Level.WARNING |
no |
Debug to file | Write logs to logfile (teamspeak.log). | False | no |
Command timeout | Time until a command waiting for a response fails | 4000 (ms) | no |
- Add Javadoc to TS3Api.
Please let me know them here. I'll help you out as soon as I can.