get client id

This commit is contained in:
Johannes Schmelz 2024-11-24 17:20:35 +01:00
parent 9b4cac4e56
commit 437114704a

View File

@ -41,6 +41,11 @@ public class NetworkSupport implements MessageListener<Client>, 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<Client>, 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.");
}