Feat: add "Fold" command

This commit is contained in:
Jona Walpert
2026-04-10 13:51:16 +02:00
parent c5518d64a3
commit d734f815e8
3 changed files with 42 additions and 0 deletions
@@ -0,0 +1,19 @@
package ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.fold;
import ch.unibas.dmi.dbis.cs108.casono.server.network.command.execution.CommandHandler;
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.OkResponse;
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.dispatcher.ResponseDispatcher;
/** Minimal handler for FOLD: acknowledges the command. */
public class PlayerFoldHandler extends CommandHandler<PlayerFoldRequest> {
public PlayerFoldHandler(ResponseDispatcher responseDispatcher) {
super(responseDispatcher);
}
@Override
public void execute(PlayerFoldRequest request) {
// TODO: integrate with game engine to process call.
responseDispatcher.dispatch(new OkResponse(request.getContext()));
}
}
@@ -0,0 +1,12 @@
package ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.fold;
import ch.unibas.dmi.dbis.cs108.casono.server.network.command.parsing.CommandParser;
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.PrimitiveRequest;
/** Parser for the FOLD command (no parameters). */
public class PlayerFoldParser implements CommandParser<PlayerFoldRequest> {
@Override
public PlayerFoldRequest parse(PrimitiveRequest primitiveRequest) {
return new PlayerFoldRequest(primitiveRequest.context());
}
}
@@ -0,0 +1,11 @@
package ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.fold;
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.Request;
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.RequestContext;
/** Request for FOLD command. */
public class PlayerFoldRequest extends Request {
public PlayerFoldRequest(RequestContext context) {
super(context);
}
}