34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
package cf.semikolon.teamspeak.query;
|
|
|
|
import com.github.theholywaffle.teamspeak3.TS3ApiAsync;
|
|
import com.github.theholywaffle.teamspeak3.TS3Config;
|
|
import com.github.theholywaffle.teamspeak3.TS3Query;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
/**
|
|
* Created by jan on 25.07.16.
|
|
*/
|
|
public class ServerQuery {
|
|
private TS3Config tsconfig = new TS3Config();
|
|
private TS3Query query;
|
|
private TS3ApiAsync api;
|
|
|
|
public ServerQuery(String host, int queryPort, int tsPort, String queryUser, String queryPassword, String nickname) {
|
|
this.tsconfig.setHost(host);
|
|
this.tsconfig.setQueryPort(queryPort);
|
|
this.query = new TS3Query(tsconfig);
|
|
this.query.connect();
|
|
System.out.println("Successfully connected to TeamSpeak!\n Logging in...");
|
|
this.api = query.getAsyncApi();
|
|
this.api.login(queryUser, queryPassword);
|
|
System.out.println("Login successfully");
|
|
this.api.selectVirtualServerByPort(tsPort);
|
|
this.api.setNickname(nickname);
|
|
}
|
|
|
|
public TS3ApiAsync getApi() {
|
|
return api;
|
|
}
|
|
}
|