added name validation
This commit is contained in:
@@ -22,8 +22,11 @@ public final class AwaitingJoinSession extends Awaiting {
|
||||
case NackMessage.GAME_ALREADY_STARTED -> client.println("Error: Game has already started.");
|
||||
case NackMessage.SESSION_FULL -> client.println("Error: The session is full.");
|
||||
case NackMessage.SESSION_NOT_FOUND -> client.println("Error: Session not found.");
|
||||
case NackMessage.NAME_TAKEN -> client.println("Error: Name already taken.");
|
||||
default -> { return super.onMessage(client, message); }
|
||||
case NackMessage.PLAYER_NAME_TAKEN -> client.println("Player name already taken.");
|
||||
case NackMessage.PLAYER_NAME_NOT_ALLOWED -> client.println("Player name not allowed.");
|
||||
case NackMessage.SESSION_NAME_TAKEN -> client.println("Session name already taken.");
|
||||
case NackMessage.SESSION_NAME_NOT_ALLOWED -> client.println("Session name not allowed.");
|
||||
default -> client.println("Nack " + nack.getCode() + ": " + nack.getMessage());
|
||||
}
|
||||
return Optional.of(new AwaitingJoinLobby());
|
||||
} else if (message instanceof SessionModifiedMessage || message instanceof SessionRemovedMessage) {
|
||||
|
Reference in New Issue
Block a user