Merge remote-tracking branch 'origin/master'

This commit is contained in:
Seraina
2022-04-18 13:44:32 +02:00
4 changed files with 170 additions and 54 deletions

View File

@@ -57,7 +57,6 @@ public class JClientProtocolParser {
System.out.println("Human Vote:");
c.positionSetter(msg.substring(6));
break;
case Protocol.serverDeliversLobbyList:
case Protocol.changedUserName:
c.changeUsername(msg.substring(6));
break;

View File

@@ -18,9 +18,10 @@ public class Protocol {
* Strings listed here). If additional information is necessary, it should be
* given after a dollar sign, as such: {@code PRTCL$information}.
* It should be noted that the server simply ignores the 6th character, however
* for clarity's sake it should always be a $.
* The client does not need to send who they are, since the server will receive
* any client message on its dedicated clientHandler thread.
* for clarity's sake it should always be a $. If more than one piece of information needs to be sent, the separate
* pieces of information should also be delimited with a dollar sign (see whisper for an example). In that case, it
* is very important that it is a $ and nothing else. Also, in such cases, we need to make sure the pieces of
* information between the $ do not contain $ themselves (for example, usernames cannot contain $).
*/
@@ -106,7 +107,6 @@ public class Protocol {
/**
* Client requests to join the Lobby with the given number, for example,
* {@code JOINL$2} means the client wants to join lobby 2.
* todo: document handling when lobby is already full
*/
public static final String joinLobby = "JOINL";
@@ -118,11 +118,11 @@ public class Protocol {
/**
* Whisper chat. Syntax: {@code WHISP$recipient's username$message}
*/
public static final String whisper ="WHISP";
public static final String whisper = "WHISP";
/**
* A Client decides to start the game. The game is started in the lobby the message came from.
* A Client (lobby admin) decides to start the game. The game is started in the lobby the message came from.
* Only one game can be started per lobby at a time.
*/
public static final String startANewGame = "STGAM";
@@ -183,12 +183,7 @@ public class Protocol {
public static final String serverRequestsHumanVote = "HVOTR";
/**
* todo: doc
*/
public static final String serverDeliversLobbyList = "LLIST"; //todo: do we need this?
/**
* Informs Client, that their username has been changed
* Informs Client that their username has been changed. Syntax {@code CHNAM$newname}
*/
public static final String changedUserName = "CHNAM";

View File

@@ -1,41 +0,0 @@
Client to server commands:
Implemented:
* LOGON$name Log on, with the name set to whatever follow $.
* CHATA$message Send chat message to all
* QUITS request to quit server/ leave server. The server should then remove the
relevant ClientHandler and close the sockets, but before doing so, it sends
"QUITC" to the client to confirm the quitting. The client doesn't close any
sockets until receiving "QUITC"
* CPING Ping from client to server.
* PINGB Pingback from client to server.
* NAMEC$name Change name to whatever is specified
* CRTGM Create a new game
*
Future / planned:
* CHATW whisper chat
* CHATG ghost chat
* LEAVG leave a game
* JOING join a game
* VOTEG ghost voting who to infect
* VOTEH humans voting who is the ghost
* LISTP list players/clients in session with the Server
* LISTL list open lobbies
Server to client Commands:
Implemented:
* SPING Ping from server to client
* PINGB Pingback from client to server.
* QUITC Confirms to the client that they are being disconnected from the server.
* LLIST$LobbyIDAndAdmin
Response to LISTL. Parameter is a string.
Future / planned:
* MSGRS "Message received": Paramaters: a string detailing to the client that and what the server received as command.
* SEROR Server had an error. (used for debugging)
* NOCMD No command found.