fix: now sends goodbyeClient message on disconnect

This commit is contained in:
Yannik Bretschneider 2021-06-07 02:13:12 +02:00
parent a25b429e1e
commit 48d9626c06
1 changed files with 4 additions and 0 deletions

View File

@ -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
}