Fix NullPointerException in App.java

This commit is contained in:
Quentin Legot 2021-11-27 19:20:27 +01:00
parent 9cfa56be8d
commit b08139ebca
2 changed files with 3 additions and 8 deletions

View File

@ -38,10 +38,10 @@ public class App extends Application {
public static void startGame() throws IllegalArgumentException, InvocationTargetException, NoSuchMethodException,
InstantiationException, IllegalAccessException {
List<Player> players = parsePlayers();
game = new Game(new Grid(12, 12, players), players);
for (Player player : game.getPlayers()) {
playerList.put(player, new ClientPlayer(player, new Terminal(game, player)));
}
game = new Game(new Grid(12, 12, players), players);
}
public static void updateView() {

View File

@ -28,11 +28,7 @@ public class Game {
this.grid = grid;
}
/**
*
* @return game winner
*/
public Player play() {
public void play() {
while(!isOver()) {
ModelListener awakeEvent = new AwakeGame(this);
generateAndGetPlayerActions(currentPlayer);
@ -41,7 +37,6 @@ public class Game {
selectedAction.doAction();
nextCurrentPlayer();
}
return getWinner();
}
private void waitForInterfaceEvent() {