improve logging
This commit is contained in:
parent
353e94899b
commit
e05e5c35d8
1 changed files with 6 additions and 2 deletions
|
@ -44,9 +44,10 @@ public class Server {
|
|||
GameProfile profile = this.handleClient(client);
|
||||
if (profile != null) {
|
||||
this.clients.remove(profile.uuid());
|
||||
System.out.printf("Closed client %s (%s)%n", client.getInetAddress(), profile.username());
|
||||
} else {
|
||||
System.out.printf("Closed client %s%n", client.getInetAddress());
|
||||
}
|
||||
|
||||
System.out.printf("Closed client %s%n", client.getInetAddress());
|
||||
} catch (Exception e) {
|
||||
System.err.printf("Failed to handle client:%n");
|
||||
e.printStackTrace(System.err);
|
||||
|
@ -123,11 +124,14 @@ public class Server {
|
|||
return profile;
|
||||
}
|
||||
|
||||
System.out.printf("Client %s authenticated as %s (%s)%n", client.getInetAddress(), profile.username(), profile.uuid());
|
||||
|
||||
boolean alreadyConnected = this.clients.containsKey(profile.uuid());
|
||||
if (alreadyConnected) {
|
||||
DisconnectPacket disconnect = new DisconnectPacket();
|
||||
disconnect.reason = "You are already connected.";
|
||||
Packets.write(disconnect, out);
|
||||
System.out.printf("Client %s (%s) disconnected because they had another connection open%n", client.getInetAddress(), profile.username());
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue