From 437114704a2c20aa2516884188fbe06722ff8653 Mon Sep 17 00:00:00 2001 From: Johannes Schmelz Date: Sun, 24 Nov 2024 17:20:35 +0100 Subject: [PATCH] get client id --- .../src/main/java/pp/monopoly/client/NetworkSupport.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkSupport.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkSupport.java index 6ae24fd..40897de 100644 --- a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkSupport.java +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/NetworkSupport.java @@ -41,6 +41,11 @@ public class NetworkSupport implements MessageListener, ClientStateListe return app; } + public int getId() { + if (client == null) return 0; + return client.getId(); + } + /** * Checks if there is a connection to the game server. * @@ -80,7 +85,7 @@ public class NetworkSupport implements MessageListener, ClientStateListe * @param port The server's port. * @throws IOException If an I/O error occurs when creating the client. */ - void initNetwork(String host, int port) throws IOException { + public void initNetwork(String host, int port) throws IOException { if (client != null) { throw new IllegalStateException("Already connected to the game server."); }