Add: LimitedList

This commit is contained in:
2026-04-24 18:28:52 +02:00
parent 73ec565ffc
commit b413ff3bcf
2 changed files with 14 additions and 10 deletions
@@ -27,14 +27,13 @@ public class ServerLauncher {
this.gameController = gameController;
this.serverTCP = serverTCP;
this.players = new LimitedList<>(5, ()->{
synchronized (gameController) {
try {
serverRMI.notifyAll(gameController.getModel());
} catch (RemoteException e) {
throw new RuntimeException(e);
}
try {
run();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
});
}
@@ -70,7 +69,10 @@ public class ServerLauncher {
public void run() throws InterruptedException, RemoteException {
// Aggiunge il primo player e imposta il numero di giocatori voluti
Game model = new Game(players.getLimit());
gameController.setModel(model);
serverRMI.notifyAll(model);
//serverTCP.broadcastUpdate(model);
while (true) {