Inserted formatting into parser
This commit is contained in:
parent
2263483462
commit
d6e938e87c
@ -11,15 +11,16 @@ public class JServerProtocolParser {
|
||||
*/
|
||||
public static void parse(String msg, ClientHandler h) {
|
||||
String header = ""; //"header" is the first 5 characters, i.e. the protocol part
|
||||
String formattedMSG = MessageFormatter.formatMsg(msg);
|
||||
try {
|
||||
header = msg.substring(0, 5);
|
||||
header = formattedMSG.substring(0, 5);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//System.out.println(header); helpful for debugging
|
||||
switch (header) {
|
||||
case "CHATA":
|
||||
h.broadcastMessage(msg.substring(6));
|
||||
h.broadcastMessage(formattedMSG.substring(6));
|
||||
break;
|
||||
case "CPING":
|
||||
h.sendMsgToClient("PINGB");
|
||||
|
||||
Reference in New Issue
Block a user