Repository navigation
Releases
Releases · GerwinT03/BattleShipsClient
Release v1.1
In this release, the entire module has been refactored. We've moved away from static methods and instead now force the student to implement the abstract methods found in the BattleShipsClient class. The client automatically parses the incoming messages into the relevant methods that the student can implement.
Just add the BattleShipsClient-1.1.jar and BattleShipsClient-1.1-sources.jar to the project as a library and implement a MyBattleShipsClient that extends from the BattleShipsClient class.
public class MyBattleShipsClient extends BattleShipsClient {
public MyBattleShipsClient(String username) {
super(username);
}
@Override
protected void onNewGame(int x, int y) {
}
etc etc....
Release v1.0
First release of BattleShipsClient library. Only receiving and sending messages are currently implemented.
You can connect to the server and send and receive commands using the following example code
BattleShipsClient.connect("localhost", 55555, "Saph");
BattleShipsClient.addListener(new IListener() {
@Override
public void onMessageReceived(String message) {
System.out.println(message);
}
});
BattleShipsClient.sendCommand("MOVE~10~12");