Source:
<code>private void onGameInfo(GameInfoMessage gameInfoMessage) { if (gameInfoMessage.getGames() != null) { gameInfoMessage.getGames().forEach(this::onGameInfo); return; } final Game game; Integer gameId = gameInfoMessage.getUid(); Player currentPlayer = playerService.getCurrentPlayer(); if (!uidToGameInfoBean.containsKey(gameId)) { game = new Game(gameInfoMessage); uidToGameInfoBean.put(gameId, game); } else { game = uidToGameInfoBean.get(gameId); Platform.runLater(() -> game.updateFromGameInfo(gameInfoMessage)); if (GameState.CLOSED == gameInfoMessage.getState()) { if (currentPlayer.getGame() == game) { currentPlayer.gameProperty().addListener((observable, oldValue, newValue) -> { if (newValue == null && oldValue.getStatus() == GameState.CLOSED) { removeGame(gameInfoMessage); } }); } else { removeGame(gameInfoMessage); } return; } } boolean currentPlayerInGame = gameInfoMessage.getTeams().values().stream() .anyMatch(team -> team.contains(currentPlayer.getUsername())); if (currentPlayerInGame && GameState.OPEN == gameInfoMessage.getState()) { synchronized (currentGame) { currentGame.set(game); } } game.statusProperty().addListener((observable, oldValue, newValue) -> { <START> if (oldValue == GameState.OPEN && newValue == GameState.PLAYING && game.getTeams().values().stream().anyMatch(team -> team.contains(currentPlayer.getUsername())) && !platformService.isGameWindowFocused()) { <END> platformService.focusGameWindow(); } }); }</code><technical_language>if (oldValue == GameState.OPEN && newValue == GameState.PLAYING && game.getTeams().values().stream().anyMatch(team -> team.contains(currentPlayer.getUsername())) && !platformService.isGameWindowFocused()) { for readability</technical_language>

Target:
private void onGameInfo(GameInfoMessage gameInfoMessage) { if (gameInfoMessage.getGames() != null) { gameInfoMessage.getGames().forEach(this::onGameInfo); return; } final Game game; Integer gameId = gameInfoMessage.getUid(); Player currentPlayer = playerService.getCurrentPlayer().orElseThrow(() -> new IllegalStateException("Player has not been set")); if (!uidToGameInfoBean.containsKey(gameId)) { game = new Game(gameInfoMessage); uidToGameInfoBean.put(gameId, game); } else { game = uidToGameInfoBean.get(gameId); Platform.runLater(() -> game.updateFromGameInfo(gameInfoMessage)); if (GameState.CLOSED == gameInfoMessage.getState()) { if (currentPlayer.getGame() == game) { currentPlayer.gameProperty().addListener((observable, oldValue, newValue) -> { if (newValue == null && oldValue.getStatus() == GameState.CLOSED) { removeGame(gameInfoMessage); } }); } else { removeGame(gameInfoMessage); } return; } } boolean currentPlayerInGame = gameInfoMessage.getTeams().values().stream() .anyMatch(team -> team.contains(currentPlayer.getUsername())); if (currentPlayerInGame && GameState.OPEN == gameInfoMessage.getState()) { synchronized (currentGame) { currentGame.set(game); } } game.statusProperty().addListener((observable, oldValue, newValue) -> { if (oldValue == GameState.OPEN && newValue == GameState.PLAYING && game.getTeams().values().stream().anyMatch(team -> team.contains(currentPlayer.getUsername())) && !platformService.isWindowFocused(faWindowTitle)) { platformService.focusWindow(faWindowTitle); } }); }