Skip to content

Commit

Permalink
Update App.java
Browse files Browse the repository at this point in the history
  • Loading branch information
TresEberle authored Apr 30, 2024
1 parent 16948a6 commit e41fadd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/uta/cse3310/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) {
}

@Override
public void onMessage(WebSocket conn, String message) {
public void onMessage(WebSocket conn, String message)
{
System.out.println("Received message from client: " + message);

// Parse the incoming message to extract sender and content
Expand Down Expand Up @@ -190,15 +191,14 @@ public void onMessage(WebSocket conn, String message) {
String sender = mO.getSender();
String content = mO.getContent();
System.out.println(sender + " : " + content);
if ("playerNick".equals(mO.getContent()))
;
if ("playerNick".equals(mO.getContent()));
{
String chatMessage = sender + ":" + content;
String jsonMessage = gson.toJson(new Message(player, content));
broadcast(chatMessage);
// broadcast(message);

}

}
// if (message.contains("content")) {
// Use JSON parsing to extract sender and content
Expand Down Expand Up @@ -233,7 +233,8 @@ public void onMessage(WebSocket conn, String message) {
// since the lobby has changed, let's send it out to everyone

String jsonString = gson.toJson(L);
broadcast(jsonString);
conn.send(jsonString);
//broadcast(jsonString);
// Player.printPlayerList();
// broadcastPlayerList();
// }
Expand Down

0 comments on commit e41fadd

Please sign in to comment.