From 48d9626c06117f07f75bc5ae974c0a8c8767342c Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Mon, 7 Jun 2021 02:13:12 +0200 Subject: [PATCH] fix: now sends goodbyeClient message on disconnect --- .../teamname/marvelous/server/netconnector/UserManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/netconnector/UserManager.java b/Server/src/main/java/uulm/teamname/marvelous/server/netconnector/UserManager.java index 5b3ebf1..c085759 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/netconnector/UserManager.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/netconnector/UserManager.java @@ -7,6 +7,7 @@ import uulm.teamname.marvelous.gamelibrary.json.ValidationUtility; import uulm.teamname.marvelous.gamelibrary.messages.BasicMessage; import uulm.teamname.marvelous.gamelibrary.messages.ErrorMessage; import uulm.teamname.marvelous.gamelibrary.messages.client.*; +import uulm.teamname.marvelous.gamelibrary.messages.server.GoodbyeClientMessage; import uulm.teamname.marvelous.gamelibrary.messages.server.HelloClientMessage; import uulm.teamname.marvelous.server.Server; import uulm.teamname.marvelous.server.lobbymanager.LobbyManager; @@ -290,6 +291,9 @@ public class UserManager { var suid = new SUID(participant.name, participant.deviceID); activeParticipants.remove(suid); } + var message = new GoodbyeClientMessage(); + message.message = "You got disconnected"; + sendMessage(conn, message); conn.close(CloseFrame.NORMAL); // this automatically calls disconnectUser through the MarvelousServer }