Browse Source

Benutzername abfrage modifiziert

remotes/origin/server
Paul Kattenborn 11 months ago
parent
commit
b762e825e9
  1. 2
      src/main/java/ChatServer.java
  2. 2
      src/main/java/ClientHandler.java
  3. 6
      user.json

2
src/main/java/ChatServer.java

@ -42,7 +42,7 @@ public class ChatServer {
System.out.println(message); System.out.println(message);
if (message != null) { if (message != null) {
for (ClientHandler client : clients) { for (ClientHandler client : clients) {
client.sendMessage(message); // Nachricht an jeden Client senden
client.sendMessage(message);
} }
} }

2
src/main/java/ClientHandler.java

@ -14,7 +14,7 @@ public class ClientHandler implements Runnable {
public ClientHandler(ChatServer chatServer, Socket connectionToClient) { public ClientHandler(ChatServer chatServer, Socket connectionToClient) {
this.chatServer = chatServer; this.chatServer = chatServer;
this.connectionToClient = connectionToClient; 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 new Thread(this).start();} // Start a new thread for this client handler

6
user.json

@ -10,11 +10,5 @@
"userName": "asd1", "userName": "asd1",
"password": "123456", "password": "123456",
"birthday": "1" "birthday": "1"
},
{
"id": "228bf4df-c730-4cd9-9d1c-2446607066aa",
"userName": "jo",
"password": "sieben",
"birthday": "jo"
} }
] ]
Loading…
Cancel
Save