Avslutter spillet om spilleren blir kastet ut

This commit is contained in:
Kristian Knarvik 2020-04-22 12:46:51 +02:00
parent 509759fdd1
commit 2c5a0e8acb

View File

@ -29,6 +29,11 @@ class RoboRallyClientListener extends Listener {
this.wrapper = wrapper;
}
@Override
public void disconnected(Connection connection) {
this.wrapper.quit("The server closed the connection.");
}
@Override
public void received(Connection connection, Object object) {
if (object instanceof ErrorResponse) {
@ -46,12 +51,12 @@ class RoboRallyClientListener extends Listener {
wrapper.roboRallyGame.setProgram(new ArrayList<>());
if (wrapper.roboRallyGame.getRobotPowerdown()) {
wrapper.roboRallyGame.setGameState(GameState.SKIP_POWER_DOWN_SCREEN);
}
else {
} else {
wrapper.roboRallyGame.setGameState(GameState.CHOOSING_POWER_DOWN);
}
} else {
wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);
}
else {wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);}
new Thread(() -> wrapper.roboRallyGame.setPlayerHand((ProgrammingCardDeck) object)).start();
} else if (object instanceof ProgamsContainer) {
new Thread(() -> {