Feat: add "Fold" command
This commit is contained in:
+19
@@ -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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user