From 8d26c3f2ea458cd3e9860cf72da856c45530fdf0 Mon Sep 17 00:00:00 2001 From: Yannik Bretschneider Date: Mon, 7 Jun 2021 17:26:30 +0200 Subject: [PATCH] fix: fixed bug where spectators sending character selection would blow up the server --- .../marvelous/server/lobbymanager/LobbyManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Server/src/main/java/uulm/teamname/marvelous/server/lobbymanager/LobbyManager.java b/Server/src/main/java/uulm/teamname/marvelous/server/lobbymanager/LobbyManager.java index 8799482..56f51e4 100644 --- a/Server/src/main/java/uulm/teamname/marvelous/server/lobbymanager/LobbyManager.java +++ b/Server/src/main/java/uulm/teamname/marvelous/server/lobbymanager/LobbyManager.java @@ -139,13 +139,19 @@ public class LobbyManager { * @return true if handled successfully, and false otherwise */ public boolean handleSelection(Client client, CharacterSelectionMessage message) { + Logger.debug("Handling characterSelection..."); if (!participants.containsKey(client.id)) { + Logger.trace("Participant didn't exist, returning..."); return false; } Participant participant = participants.get(client.id); if (participant.state != ParticipantState.Assigned) { + Logger.trace("Participant wasn't assigned, exiting..."); + return false; + } else if (participant.type == ParticipantType.Spectator) { + Logger.trace("Spectator sent message, returning..."); return false; }