From 8a86f78f4e5f149f73079074c7e40c065f5cc178 Mon Sep 17 00:00:00 2001 From: Anteneh Denbel <112484153+Antenehden@users.noreply.github.com> Date: Mon, 12 Aug 2024 00:23:53 -0500 Subject: [PATCH] Update App.java --- src/main/java/uta/cse3310/App.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/uta/cse3310/App.java b/src/main/java/uta/cse3310/App.java index 6615bca..65ffc3e 100644 --- a/src/main/java/uta/cse3310/App.java +++ b/src/main/java/uta/cse3310/App.java @@ -123,6 +123,12 @@ public void onClose(WebSocket conn, int code, String reason, boolean remote) { activeGames.remove(game); } } + + // Reset the connectionId if no active games are left + if (activeGames.isEmpty()) { + connectionId = 0; + System.out.println("No active games left. Resetting connectionId to 0."); + } } @Override