From be2c8d66985a072335934410ab7feed991776d09 Mon Sep 17 00:00:00 2001 From: sebaschi <74497638+sebaschi@users.noreply.github.com> Date: Fri, 8 Apr 2022 14:51:31 +0200 Subject: [PATCH] Added LISTL command to Protocol.java and in JServerProtocolParser.java. currently it is only logged THAt it was reached and parsed, but no functionality is attached. --- .../dmi/dbis/cs108/multiplayer/helpers/Protocol.java | 7 +++++++ .../multiplayer/server/JServerProtocolParser.java | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/helpers/Protocol.java b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/helpers/Protocol.java index 9ba1014..47cf4c5 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/helpers/Protocol.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/helpers/Protocol.java @@ -62,6 +62,13 @@ public class Protocol { */ public static final String createNewGame = "CRTGM"; + /** + * TODO: implement in {@link ch.unibas.dmi.dbis.cs108.multiplayer.client.MessageFormatter} + * TODO: imlement in {@link ch.unibas.dmi.dbis.cs108.multiplayer.server.JServerProtocolParser} + * Represents a clients request for a list of lobbies + */ + public static final String listLobbies = "LISTL"; + //SERVER TO CLIENT COMMANDS /** diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/server/JServerProtocolParser.java b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/server/JServerProtocolParser.java index b0fa84e..0983bd4 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/server/JServerProtocolParser.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/multiplayer/server/JServerProtocolParser.java @@ -18,9 +18,9 @@ public class JServerProtocolParser { /** - * Used by the server (i.e. ClientHandler{@link ClientHandler}) to parse an incoming protocol message. For - * documentation on the individual Protocol messages, view the Protocol.java class or hover over - * the commands (e.g. Protocol.chatMsgToAll) with your mouse in this class. + * Used by the server (i.e. ClientHandler{@link ClientHandler}) to parse an incoming protocol + * message. For documentation on the individual Protocol messages, view the Protocol.java class or + * hover over the commands (e.g. Protocol.chatMsgToAll) with your mouse in this class. * * @param msg the encoded message that needs to be parsed * @param h this ClientHandler (required so this method can access the ClientHandler's methods) @@ -63,6 +63,10 @@ public class JServerProtocolParser { + " command reached in JServerProtocolParser. Command issued by: " + h.getClientUserName()); break; + case Protocol.listLobbies: + //TODO: add action + LOGGER.debug(Protocol.listLobbies + " command recieved from: " + h.getClientUserName()); + break; default: System.out.println("Received unknown command"); }