Skip to content

Commit 21c7511

Browse files
committed
1.0.9: GPL -> MIT, maven and javadoc supported
1 parent 635ad33 commit 21c7511

File tree

197 files changed

+6258
-3587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+6258
-3587
lines changed

LICENSE

Lines changed: 22 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,38 @@ An Java 7 implementation of [TeamSpeak's 3 server query API](http://media.teamsp
1313

1414
## Getting Started
1515

16-
First of all, you can always download the latest release [here](../../releases/latest) and add it to the buildpath of your project. Or you can also just download the sourcecode and put it in your project's source folder.
16+
First of all, you can always download the latest release [here](../../releases/latest) and add it to the buildpath of your project.
17+
18+
Or if you prefer Maven you add the following to your pom.xml:
19+
20+
```xml
21+
<project>
22+
...
23+
<repositories>
24+
...
25+
<repository>
26+
<id>TeamSpeak-3-Java-API-mvn-repo</id>
27+
<url>https://raw.githubusercontent.com/TheHolyWaffle/TeamSpeak-3-Java-API/mvn-repo/</url>
28+
<snapshots>
29+
<enabled>true</enabled>
30+
<updatePolicy>always</updatePolicy>
31+
</snapshots>
32+
</repository>
33+
...
34+
</repositories>
35+
36+
<dependencies>
37+
...
38+
<dependency>
39+
<groupId>com.github.theholywaffle</groupId>
40+
<artifactId>teamspeak3-api</artifactId>
41+
<version>[1.0.0,2.0.0)</version>
42+
</dependency>
43+
...
44+
</dependencies>
45+
...
46+
</project>
47+
```
1748

1849
All functionality is contained in the [TS3Api](src/main/java/com/github/theholywaffle/teamspeak3/TS3Api.java) object.
1950

@@ -42,7 +73,13 @@ api.sendChannelMessage("PutPutBot is online!");
4273
...
4374
```
4475

45-
More examples can be found [here](src/main/java/com/github/theholywaffle/teamspeak3/example).
76+
**More examples:**
77+
78+
[look here](example)
79+
80+
**Latest Javadocs:**
81+
82+
[look here](http://theholywaffle.github.io/TeamSpeak-3-Java-API/latest/)
4683

4784
**Important:**
4885

Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2014 Bert De Geyter (https://github.com/TheHolyWaffle).
3-
* All rights reserved. This program and the accompanying materials
4-
* are made available under the terms of the GNU Public License v3.0
5-
* which accompanies this distribution, and is available at
6-
* http://www.gnu.org/licenses/gpl.html
1+
/*
2+
* #%L
3+
* TeamSpeak 3 Java API
4+
* %%
5+
* Copyright (C) 2014 Bert De Geyter
6+
* %%
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
713
*
8-
* Contributors:
9-
* Bert De Geyter (https://github.com/TheHolyWaffle)
10-
******************************************************************************/
11-
package com.github.theholywaffle.teamspeak3.example;
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
* #L%
25+
*/
1226

1327
import java.util.logging.Level;
1428

@@ -26,7 +40,7 @@
2640
import com.github.theholywaffle.teamspeak3.api.event.TextMessageEvent;
2741

2842
public class ChatBotExample {
29-
43+
3044
public static void main(String[] args) {
3145
new ChatBotExample();
3246
}
@@ -36,55 +50,58 @@ public ChatBotExample() {
3650
config.setHost("77.77.77.77");
3751
config.setDebugLevel(Level.ALL);
3852
config.setLoginCredentials("serveradmin", "serveradminpassword");
39-
53+
4054
final TS3Query query = new TS3Query(config);
4155
query.connect();
42-
56+
4357
final TS3Api api = query.getApi();
4458
api.selectVirtualServerById(1);
4559
api.setNickname("PutPutBot");
4660
api.sendChannelMessage("PutPutBot is online!");
47-
61+
4862
api.registerAllEvents();
4963
api.addTS3Listeners(new TS3Listener() {
50-
64+
5165
public void onTextMessage(TextMessageEvent e) {
52-
if(e.getTargetMode()== TextMessageTargetMode.CHANNEL){//Only react to channel messages
53-
if(e.getMessage().equals("!ping")){
66+
if (e.getTargetMode() == TextMessageTargetMode.CHANNEL) {// Only
67+
// react
68+
// to
69+
// channel
70+
// messages
71+
if (e.getMessage().equals("!ping")) {
5472
api.sendChannelMessage("pong");
5573
}
56-
if(e.getMessage().toLowerCase().contains("hello")){
57-
api.sendChannelMessage("Hello "+e.getInvokerName());
74+
if (e.getMessage().toLowerCase().contains("hello")) {
75+
api.sendChannelMessage("Hello " + e.getInvokerName());
5876
}
5977
}
6078
}
61-
79+
6280
public void onServerEdit(ServerEditedEvent e) {
63-
81+
6482
}
65-
83+
6684
public void onClientMoved(ClientMovedEvent e) {
67-
85+
6886
}
69-
87+
7088
public void onClientLeave(ClientLeaveEvent e) {
71-
89+
7290
}
73-
91+
7492
public void onClientJoin(ClientJoinEvent e) {
75-
93+
7694
}
77-
95+
7896
public void onChannelEdit(ChannelEditedEvent e) {
79-
97+
8098
}
81-
82-
public void onChannelDescriptionChanged(ChannelDescriptionEditedEvent e) {
83-
99+
100+
public void onChannelDescriptionChanged(
101+
ChannelDescriptionEditedEvent e) {
102+
84103
}
85104
});
86105
}
87106

88-
89-
90107
}

example/ClientInfoExample.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* #%L
3+
* TeamSpeak 3 Java API
4+
* %%
5+
* Copyright (C) 2014 Bert De Geyter
6+
* %%
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
* #L%
25+
*/
26+
27+
import java.util.logging.Level;
28+
29+
import com.github.theholywaffle.teamspeak3.TS3Api;
30+
import com.github.theholywaffle.teamspeak3.TS3Config;
31+
import com.github.theholywaffle.teamspeak3.TS3Query;
32+
import com.github.theholywaffle.teamspeak3.api.wrapper.Client;
33+
34+
public class ClientInfoExample {
35+
36+
public static void main(String[] args) {
37+
new ClientInfoExample();
38+
}
39+
40+
public ClientInfoExample() {
41+
final TS3Config config = new TS3Config();
42+
config.setHost("77.77.77.77");
43+
config.setDebugLevel(Level.ALL);
44+
config.setLoginCredentials("serveradmin", "serveradminpassword");
45+
46+
final TS3Query query = new TS3Query(config);
47+
query.connect();
48+
49+
final TS3Api api = query.getApi();
50+
api.selectVirtualServerById(1);
51+
api.setNickname("PutPutBot");
52+
api.sendChannelMessage("PutPutBot is online!");
53+
54+
for (final Client c : api.getClients()) {
55+
System.out.println(c.getNickname() + " in channel: "
56+
+ api.getChannelInfo(c.getChannelId()).getName());
57+
}
58+
}
59+
60+
}

example/CreateChannelExample.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* #%L
3+
* TeamSpeak 3 Java API
4+
* %%
5+
* Copyright (C) 2014 Bert De Geyter
6+
* %%
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
* #L%
25+
*/
26+
27+
import java.util.HashMap;
28+
import java.util.logging.Level;
29+
30+
import com.github.theholywaffle.teamspeak3.TS3Api;
31+
import com.github.theholywaffle.teamspeak3.TS3Config;
32+
import com.github.theholywaffle.teamspeak3.TS3Query;
33+
import com.github.theholywaffle.teamspeak3.api.ChannelProperty;
34+
35+
public class CreateChannelExample {
36+
37+
public static void main(String[] args) {
38+
new ChatBotExample();
39+
}
40+
41+
public CreateChannelExample() {
42+
final TS3Config config = new TS3Config();
43+
config.setHost("77.77.77.77");
44+
config.setDebugLevel(Level.ALL);
45+
config.setLoginCredentials("serveradmin", "serveradminpassword");
46+
47+
final TS3Query query = new TS3Query(config);
48+
query.connect();
49+
50+
final TS3Api api = query.getApi();
51+
api.selectVirtualServerById(1);
52+
api.setNickname("PutPutBot");
53+
api.sendChannelMessage("PutPutBot is online!");
54+
55+
final HashMap<ChannelProperty, String> properties = new HashMap<>();
56+
properties.put(ChannelProperty.CHANNEL_FLAG_PERMANENT, "1"); // Make
57+
// channel
58+
// permanent
59+
properties.put(ChannelProperty.CPID, "3"); // Make it a subchannel of
60+
// channel 3
61+
62+
api.createChannel("New Channel", properties); // Create the channel with
63+
// our properties :)
64+
}
65+
66+
}
Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
/*******************************************************************************
2-
* Copyright (c) 2014 Bert De Geyter (https://github.com/TheHolyWaffle).
3-
* All rights reserved. This program and the accompanying materials
4-
* are made available under the terms of the GNU Public License v3.0
5-
* which accompanies this distribution, and is available at
6-
* http://www.gnu.org/licenses/gpl.html
1+
/*
2+
* #%L
3+
* TeamSpeak 3 Java API
4+
* %%
5+
* Copyright (C) 2014 Bert De Geyter
6+
* %%
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
713
*
8-
* Contributors:
9-
* Bert De Geyter (https://github.com/TheHolyWaffle)
10-
******************************************************************************/
11-
package com.github.theholywaffle.teamspeak3.example;
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
* #L%
25+
*/
1226

1327
import java.util.logging.Level;
1428

@@ -25,7 +39,7 @@
2539
import com.github.theholywaffle.teamspeak3.api.event.TextMessageEvent;
2640

2741
public class EventListenerExample {
28-
42+
2943
public static void main(String[] args) {
3044
new EventListenerExample();
3145
}
@@ -35,10 +49,10 @@ public EventListenerExample() {
3549
config.setHost("77.77.77.77");
3650
config.setDebugLevel(Level.ALL);
3751
config.setLoginCredentials("serveradmin", "serveradminpassword");
38-
52+
3953
final TS3Query query = new TS3Query(config);
4054
query.connect();
41-
55+
4256
final TS3Api api = query.getApi();
4357
api.selectVirtualServerById(1);
4458
api.setNickname("PutPutBot");
@@ -82,7 +96,6 @@ public void onChannelDescriptionChanged(
8296
}
8397
});
8498

85-
86-
}
99+
}
87100

88101
}

0 commit comments

Comments
 (0)