From b762e825e9f19b38b4a8daca5f58c3321f706426 Mon Sep 17 00:00:00 2001 From: Paul Kattenborn Date: Thu, 8 Feb 2024 14:50:42 +0100 Subject: [PATCH] Benutzername abfrage modifiziert --- src/main/java/ChatServer.java | 8 ++++---- src/main/java/ClientHandler.java | 2 +- user.json | 6 ------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/ChatServer.java b/src/main/java/ChatServer.java index e9cfb35..f43051b 100644 --- a/src/main/java/ChatServer.java +++ b/src/main/java/ChatServer.java @@ -39,10 +39,10 @@ public class ChatServer { } // Methode, um eine Nachricht an alle verbundenen Clients zu senden public void broadcastMessage(String message) { - System.out.println(message); - if (message != null) { - for (ClientHandler client : clients) { - client.sendMessage(message); // Nachricht an jeden Client senden + System.out.println(message); + if (message != null) { + for (ClientHandler client : clients) { + client.sendMessage(message); } } diff --git a/src/main/java/ClientHandler.java b/src/main/java/ClientHandler.java index d443891..edba43c 100644 --- a/src/main/java/ClientHandler.java +++ b/src/main/java/ClientHandler.java @@ -14,7 +14,7 @@ public class ClientHandler implements Runnable { public ClientHandler(ChatServer chatServer, Socket connectionToClient) { this.chatServer = chatServer; this.connectionToClient = connectionToClient; - name = JOptionPane.showInputDialog("welcher Benutzername?"); + name = JOptionPane.showInputDialog("Benutzername für neuen Client vergeben"); new Thread(this).start();} // Start a new thread for this client handler diff --git a/user.json b/user.json index 5cbff9f..0201a67 100644 --- a/user.json +++ b/user.json @@ -10,11 +10,5 @@ "userName": "asd1", "password": "123456", "birthday": "1" - }, - { - "id": "228bf4df-c730-4cd9-9d1c-2446607066aa", - "userName": "jo", - "password": "sieben", - "birthday": "jo" } ] \ No newline at end of file