@@ -118,7 +118,7 @@ public void enterRoom(RoomValidationRequest request) {
118118 }
119119
120120 if (room .getRoomSetting ().locked ()
121- && !room .getRoomSetting ().password ().equals (request .password ())) {
121+ && !room .getRoomSetting ().password ().equals (request .password ())) {
122122 throw new CustomException (RoomErrorCode .WRONG_PASSWORD );
123123 }
124124
@@ -140,12 +140,12 @@ public void initializeRoomSocket(Long roomId, String sessionId, UserPrincipal pr
140140 Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
141141
142142 GameSettingResponse gameSettingResponse =
143- toGameSettingResponse (room .getGameSetting (), quiz );
143+ toGameSettingResponse (room .getGameSetting (), quiz );
144144
145145 PlayerListResponse playerListResponse = toPlayerListResponse (room );
146146
147147 SystemNoticeResponse systemNoticeResponse =
148- ofPlayerEvent (player .getNickname (), RoomEventType .ENTER );
148+ ofPlayerEvent (player .getNickname (), RoomEventType .ENTER );
149149
150150 String destination = getDestination (roomId );
151151
@@ -181,7 +181,7 @@ public void exitRoom(Long roomId, String sessionId, UserPrincipal principal) {
181181 removePlayer (room , sessionId , removePlayer );
182182
183183 SystemNoticeResponse systemNoticeResponse =
184- ofPlayerEvent (removePlayer .nickname , RoomEventType .EXIT );
184+ ofPlayerEvent (removePlayer .nickname , RoomEventType .EXIT );
185185
186186 PlayerListResponse playerListResponse = toPlayerListResponse (room );
187187
@@ -192,9 +192,9 @@ public void exitRoom(Long roomId, String sessionId, UserPrincipal principal) {
192192
193193 public void handlePlayerReady (Long roomId , String sessionId ) {
194194 Player player =
195- roomRepository
196- .findPlayerInRoomBySessionId (roomId , sessionId )
197- .orElseThrow (() -> new CustomException (RoomErrorCode .PLAYER_NOT_FOUND ));
195+ roomRepository
196+ .findPlayerInRoomBySessionId (roomId , sessionId )
197+ .orElseThrow (() -> new CustomException (RoomErrorCode .PLAYER_NOT_FOUND ));
198198
199199 player .toggleReady ();
200200
@@ -208,15 +208,15 @@ public void handlePlayerReady(Long roomId, String sessionId) {
208208 public RoomListResponse getAllRooms () {
209209 List <Room > rooms = roomRepository .findAll ();
210210 List <RoomResponse > roomResponses =
211- rooms .stream ()
212- .map (
213- room -> {
214- Long quizId = room .getGameSetting ().getQuizId ();
215- Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
216-
217- return toRoomResponse (room , quiz );
218- })
219- .toList ();
211+ rooms .stream ()
212+ .map (
213+ room -> {
214+ Long quizId = room .getGameSetting ().getQuizId ();
215+ Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
216+
217+ return toRoomResponse (room , quiz );
218+ })
219+ .toList ();
220220 return new RoomListResponse (roomResponses );
221221 }
222222
@@ -241,14 +241,14 @@ public void chat(Long roomId, String sessionId, ChatMessage chatMessage) {
241241 room .increasePlayerCorrectCount (sessionId );
242242
243243 messageSender .send (
244- destination ,
245- MessageType .QUESTION_RESULT ,
246- toQuestionResultResponse (chatMessage .nickname (), answer ));
244+ destination ,
245+ MessageType .QUESTION_RESULT ,
246+ toQuestionResultResponse (chatMessage .nickname (), answer ));
247247 messageSender .send (destination , MessageType .RANK_UPDATE , toRankUpdateResponse (room ));
248248 messageSender .send (
249- destination ,
250- MessageType .SYSTEM_NOTICE ,
251- ofPlayerEvent (chatMessage .nickname (), RoomEventType .CORRECT_ANSWER ));
249+ destination ,
250+ MessageType .SYSTEM_NOTICE ,
251+ ofPlayerEvent (chatMessage .nickname (), RoomEventType .CORRECT_ANSWER ));
252252
253253 timerService .cancelTimer (room );
254254
@@ -263,9 +263,9 @@ public void chat(Long roomId, String sessionId, ChatMessage chatMessage) {
263263 // 타이머 추가하기
264264 timerService .startTimer (room , CONTINUE_DELAY );
265265 messageSender .send (
266- destination ,
267- MessageType .QUESTION_START ,
268- toQuestionStartResponse (room , CONTINUE_DELAY ));
266+ destination ,
267+ MessageType .QUESTION_START ,
268+ toQuestionStartResponse (room , CONTINUE_DELAY ));
269269 }
270270 }
271271
@@ -309,7 +309,7 @@ public void notifyIfReconnected(Long roomId, UserPrincipal principal) {
309309 Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
310310
311311 GameSettingResponse gameSettingResponse =
312- toGameSettingResponse (room .getGameSetting (), quiz );
312+ toGameSettingResponse (room .getGameSetting (), quiz );
313313
314314 PlayerListResponse playerListResponse = toPlayerListResponse (room );
315315
@@ -318,9 +318,9 @@ public void notifyIfReconnected(Long roomId, UserPrincipal principal) {
318318 messageSender .send (destination , MessageType .PLAYER_LIST , playerListResponse );
319319
320320 messageSender .send (
321- destination ,
322- MessageType .SYSTEM_NOTICE ,
323- ofPlayerEvent (principal .getUserNickname (), RoomEventType .RECONNECT ));
321+ destination ,
322+ MessageType .SYSTEM_NOTICE ,
323+ ofPlayerEvent (principal .getUserNickname (), RoomEventType .RECONNECT ));
324324 }
325325
326326 private Player getRemovePlayer (Room room , String sessionId , UserPrincipal principal ) {
@@ -342,8 +342,8 @@ private Player createPlayer() {
342342
343343 private Room findRoom (Long roomId ) {
344344 return roomRepository
345- .findRoom (roomId )
346- .orElseThrow (() -> new CustomException (RoomErrorCode .ROOM_NOT_FOUND ));
345+ .findRoom (roomId )
346+ .orElseThrow (() -> new CustomException (RoomErrorCode .ROOM_NOT_FOUND ));
347347 }
348348
349349 private boolean isLastPlayer (Room room , String sessionId ) {
@@ -362,14 +362,14 @@ private void changeHost(Room room, String hostSessionId) {
362362 Map <String , Player > playerSessionMap = room .getPlayerSessionMap ();
363363
364364 Optional <String > nextHostSessionId =
365- playerSessionMap .keySet ().stream ()
366- .filter (key -> !key .equals (hostSessionId ))
367- .findFirst ();
365+ playerSessionMap .keySet ().stream ()
366+ .filter (key -> !key .equals (hostSessionId ))
367+ .findFirst ();
368368
369369 Player nextHost =
370- playerSessionMap .get (
371- nextHostSessionId .orElseThrow (
372- () -> new CustomException (RoomErrorCode .SOCKET_SESSION_NOT_FOUND )));
370+ playerSessionMap .get (
371+ nextHostSessionId .orElseThrow (
372+ () -> new CustomException (RoomErrorCode .SOCKET_SESSION_NOT_FOUND )));
373373
374374 room .updateHost (nextHost );
375375 log .info ("user_id:{} 방장 변경 완료 " , nextHost .getId ());
0 commit comments