Teamspeak-Query get's blocked by User after joining

61 views Asked by At

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();
}

}

1

There are 1 answers

0
Jake Hassings On

If you want to perform asynchronous actions such as listening for events (client connections), you need to use the asynchronous library

From the README:

Features

  • Contains almost all server query functionality! (see TeamSpeak 3 Server Query Manual)
  • Built-in keep alive method
  • Threaded event-based system
  • Both synchronous and asynchronous implementations available
  • Can be set up to reconnect and automatically resume execution after a connection problem
  • Utilizes SLF4J for logging abstraction and integrates with your logging configuration

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