From 141469c11f4a3f08fe1887e127838574b306cb39 Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Tue, 1 Jun 2021 16:34:08 +0200 Subject: [PATCH] refactor: changed returnType of checkRequestAndApply to optional --- .../marvelous/gamelibrary/gamelogic/GameInstance.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java index e93bd0d..ce82264 100644 --- a/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java +++ b/src/main/java/uulm/teamname/marvelous/gamelibrary/gamelogic/GameInstance.java @@ -8,6 +8,7 @@ import uulm.teamname.marvelous.gamelibrary.json.config.ScenarioConfig; import uulm.teamname.marvelous.gamelibrary.requests.Request; import java.util.ArrayList; +import java.util.Optional; /** Represents a game instance. */ public class GameInstance { @@ -32,14 +33,14 @@ public class GameInstance { * @param requests The requests to check * @return The list of resulting {@link Event}s or `null` if the check failed */ - public ArrayList checkRequestsAndApply(Request... requests) { + public Optional> checkRequestsAndApply(Request... requests) { if(manager.processRequests(requests, true)) { ArrayList result = manager.apply(); result.addAll(manager.checkPostPhase()); - return result; + return Optional.of(result); } - return null; + return Optional.empty(); } /**