jOpenTTDLib Wiki
Brought to you by:
matsandreassen
The entry point for the library is the GameQuerier interface. There is currently only one implementation: UDPGameQuerier. This object can be used thusly:
:::java
GameQuerier q = new UDPGameQuerier( host, localPort, port );
Game game = q.getAllInformation();
System.out.println( game.toString() );
This prints all the information the GameQuerier has gathered.
If you want to monitor a server and listen for events:
:::java
OpenTTDListener myListener = null; // Implement your listener
ServerMonitor mon = new ServerMonitor( gameQuerier, 2000, false);
mon.addListeners( myListener );
mon.start();
Calling start will cause it to spawn a poller thread and start monitoring the specified server by polling it every 2 seconds. If you've added at least one listener, events will fire which your listeners can handle.
Coming soon, hopefully!