3.1 Getting Started - AlexTape/UniBox GitHub Wiki
After you set the UniBoxClient.jar and UniBoxCore.jar as required dependencies of your project, your are able to set it up to suit your needs.
First of all you have to set your username and password together with the IP address of the UniBoxServer instance. To be flexible, the API will provide different methods for that task to fit your needs.
You can pass your credentials as parameters as follows:
java -jar YourGame.jar <ip> <user> <password>
If you prefer that way, simply add the following calls to your main():
public static void main(final String[] args) {
// init credentials
ClientProvider.setIp(args[0]);
ClientProvider.setUsername(args[1]);
ClientProvider.setPassword(args[2]);
Application.launch(args);
}If you prefer a more static way you can place these methods in your start() method as well:
public final void start(final Stage primaryStage) {
// init credentials
ClientProvider.setIp("192.168.0.150");
ClientProvider.setUsername("user");
ClientProvider.setPassword("password");
// ...
}
After the credentials and the IP have been set, you can call the login routine to register your application to the backend service.
ClientProvider.login();
Now you have a valid cookie to talk to the backend workers via an authorized channel. To start the main loop of the Client API, you have to connect the local workers/threads of your application with the backend.
ClientProvider.connect();