Last active
January 22, 2016 15:48
-
-
Save siasur/af7d475133651e1ff660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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