Feat: add "Call" command

This commit is contained in:
Jona Walpert
2026-04-10 13:51:48 +02:00
parent d734f815e8
commit 5916c26b86
3 changed files with 44 additions and 0 deletions
@@ -0,0 +1,21 @@
package ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.call;
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 CALL: acknowledges the command.
*/
public class PlayerCallHandler extends CommandHandler<PlayerCallRequest> {
public PlayerCallHandler(ResponseDispatcher responseDispatcher) {
super(responseDispatcher);
}
@Override
public void execute(PlayerCallRequest 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.call;
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 CALL command (no parameters). */
public class PlayerCallParser implements CommandParser<PlayerCallRequest> {
@Override
public PlayerCallRequest parse(PrimitiveRequest primitiveRequest) {
return new PlayerCallRequest(primitiveRequest.context());
}
}
@@ -0,0 +1,11 @@
package ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.call;
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 CALL command. */
public class PlayerCallRequest extends Request {
public PlayerCallRequest(RequestContext context) {
super(context);
}
}