Add: LimitedList
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user