i program a query thats writes each user a message after join. The query is already blocked before the users can join and receive the message. The bot runs over the holywaffle-teamspeak-api.
public class Main {
public static TS3Config config = new TS3Config();
public static TS3Query query = new TS3Query(config);
public static TS3Api api = new TS3Api(query);
public static void main(String[] args) {
// connection settings
config.setHost("XX");
query.connect();
// api settings
api.login(Config.getInstance().query_name, "XX");
config.setQueryPort(Config.getInstance().query_port);
config.setFloodRate(FloodRate.UNLIMITED);
config.setDebugToFile(true);
api.selectVirtualServerById(1);
api.setNickname(Config.getInstance().bot_nickname);
config.setDebugLevel(Level.ALL);
// loading all methods
TS3Events.load();
Config.main(args);
Debugg.debugg();
}
}
If you want to perform asynchronous actions such as listening for events (client connections), you need to use the asynchronous library
From the README:
The the asynchronous class is
TS3ApiAsync:https://github.com/TheHolyWaffle/TeamSpeak-3-Java-API/blob/master/src/main/java/com/github/theholywaffle/teamspeak3/TS3ApiAsync.java
[EDIT] Here is an example using the asynchronous library in case you are unfamiliar:
https://github.com/TheHolyWaffle/TeamSpeak-3-Java-API/blob/master/example/TrollExample.java