@@ -110,7 +110,7 @@ public void enterRoom(RoomValidationRequest request) {
110110 }
111111
112112 if (room .getRoomSetting ().locked ()
113- && !room .getRoomSetting ().password ().equals (request .password ())) {
113+ && !room .getRoomSetting ().password ().equals (request .password ())) {
114114 throw new CustomException (RoomErrorCode .WRONG_PASSWORD );
115115 }
116116
@@ -119,7 +119,7 @@ public void enterRoom(RoomValidationRequest request) {
119119 }
120120
121121 public RoomInitialData initializeRoomSocket (
122- Long roomId , String sessionId , UserPrincipal principal ) {
122+ Long roomId , String sessionId , UserPrincipal principal ) {
123123
124124 Room room = findRoom (roomId );
125125
@@ -145,15 +145,15 @@ public RoomInitialData initializeRoomSocket(
145145 Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
146146
147147 GameSettingResponse gameSettingResponse =
148- toGameSettingResponse (room .getGameSetting (), quiz );
148+ toGameSettingResponse (room .getGameSetting (), quiz );
149149
150150 PlayerListResponse playerListResponse = toPlayerListResponse (room );
151151
152152 SystemNoticeResponse systemNoticeResponse =
153- ofPlayerEvent (player .getNickname (), RoomEventType .ENTER );
153+ ofPlayerEvent (player .getNickname (), RoomEventType .ENTER );
154154
155155 return new RoomInitialData (
156- roomSettingResponse , gameSettingResponse , playerListResponse , systemNoticeResponse );
156+ roomSettingResponse , gameSettingResponse , playerListResponse , systemNoticeResponse );
157157 }
158158
159159 public RoomExitData exitRoom (Long roomId , String sessionId , UserPrincipal principal ) {
@@ -179,7 +179,7 @@ public RoomExitData exitRoom(Long roomId, String sessionId, UserPrincipal princi
179179 removePlayer (room , sessionId , removePlayer );
180180
181181 SystemNoticeResponse systemNoticeResponse =
182- ofPlayerEvent (removePlayer .nickname , RoomEventType .EXIT );
182+ ofPlayerEvent (removePlayer .nickname , RoomEventType .EXIT );
183183
184184 PlayerListResponse playerListResponse = toPlayerListResponse (room );
185185
@@ -189,9 +189,9 @@ public RoomExitData exitRoom(Long roomId, String sessionId, UserPrincipal princi
189189
190190 public PlayerListResponse handlePlayerReady (Long roomId , String sessionId ) {
191191 Player player =
192- roomRepository
193- .findPlayerInRoomBySessionId (roomId , sessionId )
194- .orElseThrow (() -> new CustomException (RoomErrorCode .PLAYER_NOT_FOUND ));
192+ roomRepository
193+ .findPlayerInRoomBySessionId (roomId , sessionId )
194+ .orElseThrow (() -> new CustomException (RoomErrorCode .PLAYER_NOT_FOUND ));
195195
196196 player .toggleReady ();
197197
@@ -203,15 +203,15 @@ public PlayerListResponse handlePlayerReady(Long roomId, String sessionId) {
203203 public RoomListResponse getAllRooms () {
204204 List <Room > rooms = roomRepository .findAll ();
205205 List <RoomResponse > roomResponses =
206- rooms .stream ()
207- .map (
208- room -> {
209- Long quizId = room .getGameSetting ().getQuizId ();
210- Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
211-
212- return toRoomResponse (room , quiz );
213- })
214- .toList ();
206+ rooms .stream ()
207+ .map (
208+ room -> {
209+ Long quizId = room .getGameSetting ().getQuizId ();
210+ Quiz quiz = quizService .getQuizWithQuestionsById (quizId );
211+
212+ return toRoomResponse (room , quiz );
213+ })
214+ .toList ();
215215 return new RoomListResponse (roomResponses );
216216 }
217217
@@ -234,12 +234,12 @@ public RoundResult chat(Long roomId, String sessionId, ChatMessage chatMessage)
234234 room .increasePlayerCorrectCount (sessionId );
235235
236236 return RoundResult .builder ()
237- .questionResult (
238- toQuestionResultResponse (currentQuestion .getId (), chatMessage , answer ))
239- .rankUpdate (toRankUpdateResponse (room ))
240- .systemNotice (ofPlayerEvent (chatMessage .nickname (), RoomEventType .ENTER ))
241- .chat (chatMessage )
242- .build ();
237+ .questionResult (
238+ toQuestionResultResponse (currentQuestion .getId (), chatMessage , answer ))
239+ .rankUpdate (toRankUpdateResponse (room ))
240+ .systemNotice (ofPlayerEvent (chatMessage .nickname (), RoomEventType .ENTER ))
241+ .chat (chatMessage )
242+ .build ();
243243 }
244244
245245 private Player getRemovePlayer (Room room , String sessionId , UserPrincipal principal ) {
@@ -261,8 +261,8 @@ private Player createPlayer() {
261261
262262 private Room findRoom (Long roomId ) {
263263 return roomRepository
264- .findRoom (roomId )
265- .orElseThrow (() -> new CustomException (RoomErrorCode .ROOM_NOT_FOUND ));
264+ .findRoom (roomId )
265+ .orElseThrow (() -> new CustomException (RoomErrorCode .ROOM_NOT_FOUND ));
266266 }
267267
268268 private boolean isLastPlayer (Room room , String sessionId ) {
@@ -282,14 +282,14 @@ private void changeHost(Room room, String hostSessionId) {
282282 Map <String , Player > playerSessionMap = room .getPlayerSessionMap ();
283283
284284 Optional <String > nextHostSessionId =
285- playerSessionMap .keySet ().stream ()
286- .filter (key -> !key .equals (hostSessionId ))
287- .findFirst ();
285+ playerSessionMap .keySet ().stream ()
286+ .filter (key -> !key .equals (hostSessionId ))
287+ .findFirst ();
288288
289289 Player nextHost =
290- playerSessionMap .get (
291- nextHostSessionId .orElseThrow (
292- () -> new CustomException (RoomErrorCode .SOCKET_SESSION_NOT_FOUND )));
290+ playerSessionMap .get (
291+ nextHostSessionId .orElseThrow (
292+ () -> new CustomException (RoomErrorCode .SOCKET_SESSION_NOT_FOUND )));
293293
294294 room .updateHost (nextHost );
295295 log .info ("user_id:{} 방장 변경 완료 " , nextHost .getId ());
@@ -303,4 +303,4 @@ private void removePlayer(Room room, String sessionId, Player removePlayer) {
303303 private RoundResult buildResultOnlyChat (ChatMessage chatMessage ) {
304304 return RoundResult .builder ().chat (chatMessage ).build ();
305305 }
306- }
306+ }
0 commit comments