From 57763309bfa8ef382e288e4a9e70c47a67a9b83f Mon Sep 17 00:00:00 2001 From: fdai7920 Date: Fri, 2 Feb 2024 15:34:34 +0100 Subject: [PATCH] refactoring: divided function in 2 parts --- src/main/java/de/hsfulda/onses/services/PlayerService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/hsfulda/onses/services/PlayerService.java b/src/main/java/de/hsfulda/onses/services/PlayerService.java index a9f651e..b3b4cc4 100644 --- a/src/main/java/de/hsfulda/onses/services/PlayerService.java +++ b/src/main/java/de/hsfulda/onses/services/PlayerService.java @@ -39,12 +39,14 @@ public class PlayerService { public PlayerService setGame(Game game) { this.game = game; + playerList.getFirst().setGame(this.game); + playerList.getLast().setGame(this.game); return this; } public PlayerService() { - addPlayerToList(new Player().setPlayerService(this).setGame(this.game)); - addPlayerToList(new Player().setPlayerService(this).setGame(this.game)); + addPlayerToList(new Player().setPlayerService(this)); + addPlayerToList(new Player().setPlayerService(this)); } }