Skip to content

Instantly share code, notes, and snippets.

@siasur
Last active January 22, 2016 15:48
Show Gist options
  • Save siasur/af7d475133651e1ff660 to your computer and use it in GitHub Desktop.
Save siasur/af7d475133651e1ff660 to your computer and use it in GitHub Desktop.
public class TsBotBootstrapper {
public static final TS3Config config;
public static TS3Query query;
public static TS3Api api;
public static TS3Listener listener;
public static void main(String[] args) {
config = new Ts3Config();
config.setHost("127.0.0.1");
config.setDebugLevel(Level.ALL);
config.setLoginCredentials("name", "password");
config.setFloodRate(FloodRate.UNLIMITED);
listener = new TsListener();
query = new TS3Query(config);
connectBot();
}
public static void connectBot() {
query.connect();
api = query.getApi();
api.selectVirtualServerByPort();
api.setNickname("Bot");
api.registerAllEvents();
api.addTS3Listeners(listener);
}
public static void disconnectBot() {
api.removeTS3Listeners(listener);
api = null;
query.exit();
}
public static void reconnectBot() {
disconnectBot();
connectBot();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment