From 876bd32bdcc64a97a9215c6d2a780d63b85869a4 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Sat, 19 Jun 2021 22:34:37 +0200 Subject: [PATCH] Fixed hard-coded host/port, and bump to version 2.1 --- client/pom.xml | 2 +- .../nl/andrewlalis/aos_client/Client.java | 19 +++++++++---------- core/pom.xml | 2 +- pom.xml | 2 +- server/pom.xml | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index 7324c97..b7f145a 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -5,7 +5,7 @@ ace-of-shades nl.andrewlalis - 2.0 + 2.1 4.0.0 diff --git a/client/src/main/java/nl/andrewlalis/aos_client/Client.java b/client/src/main/java/nl/andrewlalis/aos_client/Client.java index 62b3993..947cb72 100644 --- a/client/src/main/java/nl/andrewlalis/aos_client/Client.java +++ b/client/src/main/java/nl/andrewlalis/aos_client/Client.java @@ -2,7 +2,6 @@ package nl.andrewlalis.aos_client; import nl.andrewlalis.aos_client.view.GameFrame; import nl.andrewlalis.aos_client.view.GamePanel; -import nl.andrewlalis.aos_core.model.Player; import nl.andrewlalis.aos_core.model.PlayerControlState; import nl.andrewlalis.aos_core.model.World; import nl.andrewlalis.aos_core.net.PlayerControlStateMessage; @@ -151,18 +150,18 @@ public class Client { public static void main(String[] args) { -// String hostAndPort = JOptionPane.showInputDialog("Enter server host and port (host:port):"); -// if (hostAndPort == null) throw new IllegalArgumentException("A host and port is required."); -// String[] parts = hostAndPort.split(":"); -// if (parts.length != 2) throw new IllegalArgumentException("Invalid host:port."); -// String host = parts[0].trim(); -// int port = Integer.parseInt(parts[1]); -// String username = JOptionPane.showInputDialog("Enter a username:"); -// if (username == null || username.isBlank()) throw new IllegalArgumentException("Username is required."); + String hostAndPort = JOptionPane.showInputDialog("Enter server host and port (host:port):"); + if (hostAndPort == null) throw new IllegalArgumentException("A host and port is required."); + String[] parts = hostAndPort.split(":"); + if (parts.length != 2) throw new IllegalArgumentException("Invalid host:port."); + String host = parts[0].trim(); + int port = Integer.parseInt(parts[1]); + String username = JOptionPane.showInputDialog("Enter a username:"); + if (username == null || username.isBlank()) throw new IllegalArgumentException("Username is required."); Client client = new Client(); try { - client.connect("localhost", 8035, "andrew"); + client.connect(host, port, username); } catch (IOException | ClassNotFoundException e) { client.shutdown(); e.printStackTrace(); diff --git a/core/pom.xml b/core/pom.xml index a6e3e74..4271fc1 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ ace-of-shades nl.andrewlalis - 2.0 + 2.1 4.0.0 diff --git a/pom.xml b/pom.xml index 97cfe50..66613b3 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ nl.andrewlalis ace-of-shades pom - 2.0 + 2.1 server client diff --git a/server/pom.xml b/server/pom.xml index c61a47e..8b8d65e 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -5,7 +5,7 @@ ace-of-shades nl.andrewlalis - 2.0 + 2.1 4.0.0