feat: make timer stop game (Fixes #15)
All checks were successful
Linux arm64 / Build (push) Successful in 29s

This commit is contained in:
2025-02-01 13:41:13 +01:00
parent f22debdf5f
commit 352aee49e4
11 changed files with 109 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Random;
import common.ConsumerSignal;
import common.Signal;
import game.Game;
import game.Player;
@@ -21,6 +22,7 @@ public class Client {
public final Signal onDisconnect = new Signal();
public final Signal onClosed = new Signal();
public final Signal onGameStarted = new Signal();
public final ConsumerSignal<Player> onGameEnd = new ConsumerSignal<>();
Player player;

View File

@@ -78,8 +78,9 @@ public class ClientConnexion extends Connexion {
@Override
public void visitPacket(EndGamePacket packet) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'visitPacket'");
Player winner = this.client.getGame().getLeaderboard().getFirst();
this.client.getGame().stopGame();
this.client.onGameEnd.emit(winner);
}
@Override