Feat/96 add getlobbystatus command on server side #260

Merged
jona.walpert merged 4 commits from feat/96-add-getlobbystatus-command-on-server-side into main 2026-04-11 21:09:05 +02:00
Showing only changes of commit 46ccae40ad - Show all commits
@@ -11,13 +11,9 @@ import java.util.Optional;
/** /**
* Handler for the `GET_LOBBY_STATUS` command. * Handler for the `GET_LOBBY_STATUS` command.
* *
* <p> * <p>Resolves the target lobby either by the optional `ID` parameter or by `USERNAME`. If both are
* Resolves the target lobby either by the optional `ID` parameter or by * omitted the handler requires the session to be associated with a logged-in user (see the inline
* `USERNAME`. If both are * pre-execution check). On success a {@link GetLobbyStatusResponse} is dispatched, otherwise an
* omitted the handler requires the session to be associated with a logged-in
* user (see the inline
* pre-execution check). On success a {@link GetLobbyStatusResponse} is
* dispatched, otherwise an
* {@link ErrorResponse} with code `LOBBY_NOT_FOUND` is sent. * {@link ErrorResponse} with code `LOBBY_NOT_FOUND` is sent.
*/ */
public class GetLobbyStatusHandler extends CommandHandler<GetLobbyStatusRequest> { public class GetLobbyStatusHandler extends CommandHandler<GetLobbyStatusRequest> {
@@ -67,11 +63,12 @@ public class GetLobbyStatusHandler extends CommandHandler<GetLobbyStatusRequest>
} }
} }
var lobby = (request.getId() != null) var lobby =
? lobbyManager.getLobby(LobbyId.of(request.getId())) (request.getId() != null)
: (targetUsername != null ? lobbyManager.getLobby(LobbyId.of(request.getId()))
? lobbyManager.getLobbyByUsername(targetUsername) : (targetUsername != null
: null); ? lobbyManager.getLobbyByUsername(targetUsername)
: null);
if (lobby == null) { if (lobby == null) {
responseDispatcher.dispatch( responseDispatcher.dispatch(