Feat: register "Call", "Fold","Bet","Raise","AddPlayer" command and change import locatio nto match new folder structure
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
package ch.unibas.dmi.dbis.cs108.casono.server;
|
||||
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.add_player.AddPlayerHandler;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.add_player.AddPlayerParser;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.add_player.AddPlayerRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.bet.PlayerBetHandler;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.bet.PlayerBetParser;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.bet.PlayerBetRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.call.PlayerCallHandler;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.call.PlayerCallParser;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.call.PlayerCallRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameHandler;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameParser;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.check_nick.CheckUsernameRequest;
|
||||
@@ -15,6 +24,9 @@ import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.logout.LogoutRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.ping.PingHandler;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.ping.PingParser;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.ping.PingRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.raise.PlayerRaiseHandler;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.raise.PlayerRaiseParser;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.raise.PlayerRaiseRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.domain.user.UserCleanupJob;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.domain.user.UserRegistry;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.NetworkManager;
|
||||
@@ -85,9 +97,12 @@ public class ServerApp {
|
||||
/**
|
||||
* Registers command parsers and handlers.
|
||||
*
|
||||
* @param parserDispatcher the dispatcher responsible for parsing incoming commands
|
||||
* @param commandRouter the router that dispatches parsed commands to appropriate handlers
|
||||
* @param responseDispatcher the dispatcher responsible for sending responses back to clients
|
||||
* @param parserDispatcher the dispatcher responsible for parsing incoming
|
||||
* commands
|
||||
* @param commandRouter the router that dispatches parsed commands to
|
||||
* appropriate handlers
|
||||
* @param responseDispatcher the dispatcher responsible for sending responses
|
||||
* back to clients
|
||||
*/
|
||||
private static void registerCommands(
|
||||
CommandParserDispatcher parserDispatcher,
|
||||
@@ -113,5 +128,25 @@ public class ServerApp {
|
||||
parserDispatcher.register("LIST_USERS", new ListUsersParser());
|
||||
commandRouter.register(
|
||||
ListUsersRequest.class, new ListUsersHandler(responseDispatcher, userRegistry));
|
||||
|
||||
// ADD_PLAYER
|
||||
parserDispatcher.register("ADD_PLAYER", new AddPlayerParser());
|
||||
commandRouter.register(AddPlayerRequest.class,
|
||||
new AddPlayerHandler(userRegistry, responseDispatcher));
|
||||
|
||||
// BET
|
||||
parserDispatcher.register("BET", new PlayerBetParser());
|
||||
commandRouter.register(PlayerBetRequest.class,
|
||||
new PlayerBetHandler(responseDispatcher));
|
||||
|
||||
// CALL
|
||||
parserDispatcher.register("CALL", new PlayerCallParser());
|
||||
commandRouter.register(PlayerCallRequest.class,
|
||||
new PlayerCallHandler(responseDispatcher));
|
||||
|
||||
// RAISE
|
||||
parserDispatcher.register("RAISE", new PlayerRaiseParser());
|
||||
commandRouter.register(PlayerRaiseRequest.class,
|
||||
new PlayerRaiseHandler(responseDispatcher));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
package ch.unibas.dmi.dbis.cs108.casono.server.app.commands.game.add_player;
|
||||
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.command.parsing.CommandParser;
|
||||
import ch.unibas.dmi.dbis108.casono.server.network.protocol.request.PrimitiveRequest;
|
||||
import ch.unibas.dmi.dbis108.casono.server.network.protocol.request.accessor.RequestParameterAccessor;
|
||||
import ch.unibas.dmi.dbis108.casono.server.network.protocol.request.accessor.ParameterParseException;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.PrimitiveRequest;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.RequestParameterAccessor;
|
||||
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.accessor.ParameterParseException;
|
||||
|
||||
/** Parser for the ADD_PLAYER command. */
|
||||
public class AddPlayerParser implements CommandParser<AddPlayerRequest> {
|
||||
|
||||
Reference in New Issue
Block a user