diff --git a/pom.xml b/pom.xml index 73bd47763444bfc1afaf7d4897ba980fbeab1baf..8d1353d924e27dc1a708717f1ab93310011e31e2 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,11 @@ <artifactId>reflections</artifactId> <version>0.9.11</version> </dependency> + <dependency> + <groupId>net.sf.jopt-simple</groupId> + <artifactId>jopt-simple</artifactId> + <version>5.0.3</version> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/src/main/java/com/fossgalaxy/games/fireworks/NetClient.java b/src/main/java/com/fossgalaxy/games/fireworks/NetClient.java index a7c5cc0c5ca3bf7d93b0fe365e35c30a146f4892..fe16f7870a0afd8a42fb370a9d8922becdea8e54 100644 --- a/src/main/java/com/fossgalaxy/games/fireworks/NetClient.java +++ b/src/main/java/com/fossgalaxy/games/fireworks/NetClient.java @@ -4,6 +4,8 @@ import com.fossgalaxy.games.fireworks.human.ui.UIPlayer; import com.fossgalaxy.games.fireworks.human.ui.pretty.HumanUIAgent; import com.fossgalaxy.games.fireworks.state.actions.Action; import com.fossgalaxy.games.fireworks.utils.AgentUtils; +import joptsimple.OptionParser; +import joptsimple.OptionSet; import java.io.IOException; @@ -19,8 +21,14 @@ public class NetClient { public static void main(String[] args) { + OptionParser parser = new OptionParser(); + parser.accepts("url").withOptionalArg().defaultsTo("localhost"); + + OptionSet options = parser.parse(args); + + try ( - Socket socket = new Socket("localhost", NetServer.FIREWORKS_SERVER_PORT); + Socket socket = new Socket(options.valueOf("url").toString(), NetServer.FIREWORKS_SERVER_PORT); ) { UIPlayer player = new UIPlayer("iggi", new HumanUIAgent(), true);