fix: fixed bug where spectators sending character selection would blow up the server

This commit is contained in:
Yannik Bretschneider 2021-06-07 17:26:30 +02:00
parent 6122c55025
commit 8d26c3f2ea
1 changed files with 6 additions and 0 deletions

View File

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