diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseHandler.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseHandler.java
index 4d7b647..6fbaaca 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseHandler.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseHandler.java
@@ -14,20 +14,13 @@ import java.util.Optional;
/**
* Handler for the `RAISE` command.
*
- *
- * This handler validates the request (amount >= 0), resolves the user and
- * target lobby (by
- * `GAME_ID` when provided or by session username otherwise), checks that a game
- * is running and then
+ *
This handler validates the request (amount >= 0), resolves the user and target lobby (by
+ * `GAME_ID` when provided or by session username otherwise), checks that a game is running and then
* forwards the action to the {@code GameController}.
*
- *
- * On failure the handler dispatches an {@link ErrorResponse} with an
- * appropriate error code
- * (e.g. {@code INVALID_AMOUNT}, {@code NOT_IN_LOBBY}, {@code LOBBY_NOT_FOUND},
- * {@code
- * GAME_NOT_STARTED}, {@code GAME_ACTION_FAILED}). On success it dispatches an
- * {@link OkResponse}.
+ *
On failure the handler dispatches an {@link ErrorResponse} with an appropriate error code
+ * (e.g. {@code INVALID_AMOUNT}, {@code NOT_IN_LOBBY}, {@code LOBBY_NOT_FOUND}, {@code
+ * GAME_NOT_STARTED}, {@code GAME_ACTION_FAILED}). On success it dispatches an {@link OkResponse}.
*/
public class PlayerRaiseHandler extends CommandHandler {
private final UserRegistry userRegistry;
@@ -36,11 +29,9 @@ public class PlayerRaiseHandler extends CommandHandler {
/**
* Creates a new {@code PlayerRaiseHandler}.
*
- * @param responseDispatcher dispatcher used to send responses back to the
- * client
- * @param userRegistry registry to resolve users from session ids
- * @param lobbyManager manager used to lookup lobbies and their game
- * controllers
+ * @param responseDispatcher dispatcher used to send responses back to the client
+ * @param userRegistry registry to resolve users from session ids
+ * @param lobbyManager manager used to lookup lobbies and their game controllers
*/
public PlayerRaiseHandler(
ResponseDispatcher responseDispatcher,
@@ -52,10 +43,8 @@ public class PlayerRaiseHandler extends CommandHandler {
}
/**
- * Execute the raise request: validate parameters, resolve lobby and game, and
- * forward the raise
- * action to the game controller. Sends an {@link ErrorResponse} on failure or
- * an {@link
+ * Execute the raise request: validate parameters, resolve lobby and game, and forward the raise
+ * action to the game controller. Sends an {@link ErrorResponse} on failure or an {@link
* OkResponse} on success.
*
* @param request the parsed {@link PlayerRaiseRequest}
@@ -71,8 +60,8 @@ public class PlayerRaiseHandler extends CommandHandler {
return;
}
- Optional opt = userRegistry
- .getBySessionId(request.getSessionId());
+ Optional opt =
+ userRegistry.getBySessionId(request.getSessionId());
if (opt.isEmpty()) {
responseDispatcher.dispatch(
new ErrorResponse(request.getContext(), "NOT_LOGGED_IN", "User not logged in"));
@@ -82,9 +71,10 @@ public class PlayerRaiseHandler extends CommandHandler {
String username = opt.get().getName();
Integer gameId = request.getGameId();
- var lobby = (gameId != null)
- ? lobbyManager.getLobby(LobbyId.of(gameId))
- : lobbyManager.getLobbyByUsername(username);
+ var lobby =
+ (gameId != null)
+ ? lobbyManager.getLobby(LobbyId.of(gameId))
+ : lobbyManager.getLobbyByUsername(username);
if (lobby == null) {
if (gameId != null) {
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseParser.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseParser.java
index 69aac59..efbdfe7 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseParser.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseParser.java
@@ -7,19 +7,18 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.
/**
* Parser for the `RAISE` command.
*
- *
- * Parses the request parameters and builds a {@link PlayerRaiseRequest}.
- * Expected parameters:
+ *
Parses the request parameters and builds a {@link PlayerRaiseRequest}. Expected parameters:
*
*
- * - `GAME_ID` (optional) - numeric id of the lobby/game to target
- *
- `AMOUNT` (required) - amount to raise
+ *
- `GAME_ID` (optional) - numeric id of the lobby/game to target
+ *
- `AMOUNT` (required) - amount to raise
*
*/
public class PlayerRaiseParser implements CommandParser {
@Override
public PlayerRaiseRequest parse(PrimitiveRequest primitiveRequest) {
- RequestParameterAccessor accessor = new RequestParameterAccessor(primitiveRequest.parameters());
+ RequestParameterAccessor accessor =
+ new RequestParameterAccessor(primitiveRequest.parameters());
Integer gameId = null;
try {
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseRequest.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseRequest.java
index 65e5f78..15aeb79 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseRequest.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/game/raise/PlayerRaiseRequest.java
@@ -6,9 +6,7 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.RequestCo
/**
* Request for the `RAISE` command.
*
- *
- * Contains the optional target `gameId` and the `amount` the player wants to
- * raise.
+ *
Contains the optional target `gameId` and the `amount` the player wants to raise.
*/
public class PlayerRaiseRequest extends Request {
private final Integer gameId;
@@ -18,8 +16,8 @@ public class PlayerRaiseRequest extends Request {
* Creates a new {@code PlayerRaiseRequest}.
*
* @param context the request context
- * @param gameId optional game id of the targeted lobby (may be {@code null})
- * @param amount the raise amount (non-negative)
+ * @param gameId optional game id of the targeted lobby (may be {@code null})
+ * @param amount the raise amount (non-negative)
*/
public PlayerRaiseRequest(RequestContext context, Integer gameId, int amount) {
super(context);