fix: synced timer
All checks were successful
Linux arm64 / Build (push) Successful in 26s

This commit is contained in:
2025-02-01 11:22:59 +01:00
parent 3863c812c8
commit caf6569409
7 changed files with 50 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
package game;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -14,10 +15,13 @@ public class Game {
GameNotStarted, GameGoing, GameEnd
}
public static final int GAME_DURATION = 10 * 60;
private final Map<Integer, Player> players;
private final List<Player> leaderboard;
private GameState gameState;
private MultiDoku doku;
private Instant startTime = null;
public Game() {
this.players = new HashMap<>();
@@ -49,9 +53,10 @@ public class Game {
return players;
}
public void startGame(MultiDoku doku) {
public void startGame(MultiDoku doku, Instant startTime) {
this.doku = doku;
this.gameState = GameState.GameGoing;
this.startTime = startTime;
}
public GameState getGameState() {
@@ -66,4 +71,8 @@ public class Game {
return leaderboard;
}
public Instant getStartTime() {
return startTime;
}
}