From f37928307c8cb196395b96aaba0bbf98829fd059 Mon Sep 17 00:00:00 2001 From: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com> Date: Mon, 29 Sep 2025 13:52:48 +0200 Subject: [PATCH 1/2] Update Main.java (#74) * Update Main.java * Updated main to be generic. --- app/src/main/java/org/toop/Main.java | 72 +--------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/app/src/main/java/org/toop/Main.java b/app/src/main/java/org/toop/Main.java index 77f6e6c..3bf2ce1 100644 --- a/app/src/main/java/org/toop/Main.java +++ b/app/src/main/java/org/toop/Main.java @@ -1,83 +1,13 @@ package org.toop; -import java.util.Arrays; import org.toop.app.gui.LocalServerSelector; -import org.toop.framework.eventbus.EventFlow; import org.toop.framework.networking.NetworkingClientManager; import org.toop.framework.networking.NetworkingInitializationException; -import org.toop.framework.networking.events.NetworkEvents; public class Main { static void main(String[] args) { initSystems(); - - EventFlow a = - new EventFlow() - .addPostEvent(NetworkEvents.StartClient.class, "127.0.0.1", 7789) - .onResponse(Main::login) - // .onResponse(Main::sendCommand) - // .onResponse(Main::closeClient) - .asyncPostEvent(); - - new Thread( - () -> { - while (a.getResult() == null) { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - } - long clid = (Long) a.getResult().get("clientId"); - new EventFlow() - .addPostEvent( - new NetworkEvents.SendSubscribe(clid, "tic-tac-toe")) - .listen( - NetworkEvents.PlayerlistResponse.class, - response -> { - if (response.clientId() == clid) - System.out.println( - Arrays.toString(response.playerlist())); - }) - .listen( - NetworkEvents.ChallengeResponse.class, - response -> { - if (response.clientId() == clid) - System.out.println(response.challengeId()); - }) - .listen( - NetworkEvents.ChallengeCancelledResponse.class, - response -> { - if (response.clientId() == clid) - System.out.println(response.challengeId()); - }) - .listen( - NetworkEvents.GamelistResponse.class, - response -> { - if (response.clientId() == clid) - System.out.println( - Arrays.toString(response.gamelist())); - }) - .asyncPostEvent(); - }) - .start(); - - new Thread(() -> javax.swing.SwingUtilities.invokeLater(LocalServerSelector::new)).start(); - } - - private static void login(NetworkEvents.StartClientResponse event) { - new Thread( - () -> { - try { - Thread.sleep(1000); - new EventFlow() - .addPostEvent( - new NetworkEvents.SendCommand( - event.clientId(), "login bas")) - .asyncPostEvent(); - } catch (InterruptedException e) { - } - }) - .start(); + javax.swing.SwingUtilities.invokeLater(LocalServerSelector::new); } private static void initSystems() throws NetworkingInitializationException { From d5735be2dbdedee2d6debf4a2227b554788302d6 Mon Sep 17 00:00:00 2001 From: Bas Antonius de Jong <49651652+BAFGdeJong@users.noreply.github.com> Date: Tue, 30 Sep 2025 12:07:12 +0200 Subject: [PATCH 2/2] Update git (#81) * new ignore * Delete .idea/misc.xml * Delete .idea/compiler.xml --------- Co-authored-by: Stef --- .gitignore | 2 ++ .idea/compiler.xml | 23 ----------------------- .idea/misc.xml | 19 ------------------- 3 files changed, 2 insertions(+), 42 deletions(-) delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/misc.xml diff --git a/.gitignore b/.gitignore index b561d9a..d6ebce9 100644 --- a/.gitignore +++ b/.gitignore @@ -75,6 +75,8 @@ dist/ nbdist/ nbactions.xml nb-configuration.xml +misc.xml +compiler.xml ############################## ## Visual Studio Code diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index d801bf4..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 72be14a..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file