Skip to content

Commit 0670bd5

Browse files
author
github-actions
committed
chore: Java 스타일 수정
1 parent ba9ca4d commit 0670bd5

File tree

9 files changed

+42
-45
lines changed

9 files changed

+42
-45
lines changed

backend/src/main/java/io/f1/backend/domain/game/app/ChatService.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
package io.f1.backend.domain.game.app;
22

3-
import static io.f1.backend.domain.game.mapper.RoomMapper.ofPlayerEvent;
4-
import static io.f1.backend.domain.game.mapper.RoomMapper.toQuestionResultResponse;
5-
import static io.f1.backend.domain.game.mapper.RoomMapper.toQuestionStartResponse;
6-
import static io.f1.backend.domain.game.mapper.RoomMapper.toRankUpdateResponse;
73
import static io.f1.backend.domain.game.websocket.WebSocketUtils.getDestination;
84

95
import io.f1.backend.domain.game.dto.ChatMessage;
106
import io.f1.backend.domain.game.dto.MessageType;
11-
import io.f1.backend.domain.game.dto.RoomEventType;
127
import io.f1.backend.domain.game.event.GameCorrectAnswerEvent;
138
import io.f1.backend.domain.game.model.Room;
149
import io.f1.backend.domain.game.websocket.MessageSender;
1510
import io.f1.backend.domain.question.entity.Question;
16-
import io.f1.backend.domain.user.app.UserService;
11+
1712
import lombok.RequiredArgsConstructor;
13+
1814
import org.springframework.context.ApplicationEventPublisher;
1915
import org.springframework.stereotype.Service;
2016

@@ -45,7 +41,8 @@ public void chat(Long roomId, String sessionId, ChatMessage chatMessage) {
4541
String answer = currentQuestion.getAnswer();
4642

4743
if (answer.equals(chatMessage.message())) {
48-
eventPublisher.publishEvent(new GameCorrectAnswerEvent(room, sessionId, chatMessage, answer));
44+
eventPublisher.publishEvent(
45+
new GameCorrectAnswerEvent(room, sessionId, chatMessage, answer));
4946
}
5047
}
5148
}

backend/src/main/java/io/f1/backend/domain/game/app/GameService.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ public void onCorrectAnswer(GameCorrectAnswerEvent event) {
9898
room.increasePlayerCorrectCount(sessionId);
9999

100100
messageSender.send(
101-
destination,
102-
MessageType.QUESTION_RESULT,
103-
toQuestionResultResponse(chatMessage.nickname(), answer));
101+
destination,
102+
MessageType.QUESTION_RESULT,
103+
toQuestionResultResponse(chatMessage.nickname(), answer));
104104
messageSender.send(destination, MessageType.RANK_UPDATE, toRankUpdateResponse(room));
105105
messageSender.send(
106-
destination,
107-
MessageType.SYSTEM_NOTICE,
108-
ofPlayerEvent(chatMessage.nickname(), RoomEventType.CORRECT_ANSWER));
106+
destination,
107+
MessageType.SYSTEM_NOTICE,
108+
ofPlayerEvent(chatMessage.nickname(), RoomEventType.CORRECT_ANSWER));
109109

110110
timerService.cancelTimer(room);
111111

@@ -118,9 +118,9 @@ public void onCorrectAnswer(GameCorrectAnswerEvent event) {
118118
// 타이머 추가하기
119119
timerService.startTimer(room, CONTINUE_DELAY);
120120
messageSender.send(
121-
destination,
122-
MessageType.QUESTION_START,
123-
toQuestionStartResponse(room, CONTINUE_DELAY));
121+
destination,
122+
MessageType.QUESTION_START,
123+
toQuestionStartResponse(room, CONTINUE_DELAY));
124124
}
125125

126126
@EventListener
@@ -129,13 +129,13 @@ public void onTimeout(GameTimeoutEvent event) {
129129
String destination = getDestination(room.getId());
130130

131131
messageSender.send(
132-
destination,
133-
MessageType.QUESTION_RESULT,
134-
toQuestionResultResponse(NONE_CORRECT_USER, room.getCurrentQuestion().getAnswer()));
132+
destination,
133+
MessageType.QUESTION_RESULT,
134+
toQuestionResultResponse(NONE_CORRECT_USER, room.getCurrentQuestion().getAnswer()));
135135
messageSender.send(
136-
destination,
137-
MessageType.SYSTEM_NOTICE,
138-
ofPlayerEvent(NONE_CORRECT_USER, RoomEventType.TIMEOUT));
136+
destination,
137+
MessageType.SYSTEM_NOTICE,
138+
ofPlayerEvent(NONE_CORRECT_USER, RoomEventType.TIMEOUT));
139139

140140
if (!timerService.validateCurrentRound(room)) {
141141
gameEnd(room);
@@ -146,9 +146,9 @@ public void onTimeout(GameTimeoutEvent event) {
146146

147147
timerService.startTimer(room, CONTINUE_DELAY);
148148
messageSender.send(
149-
destination,
150-
MessageType.QUESTION_START,
151-
toQuestionStartResponse(room, CONTINUE_DELAY));
149+
destination,
150+
MessageType.QUESTION_START,
151+
toQuestionStartResponse(room, CONTINUE_DELAY));
152152
}
153153

154154
public void gameEnd(Room room) {

backend/src/main/java/io/f1/backend/domain/game/app/RoomService.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@
44
import static io.f1.backend.domain.game.mapper.RoomMapper.toGameSetting;
55
import static io.f1.backend.domain.game.mapper.RoomMapper.toGameSettingResponse;
66
import static io.f1.backend.domain.game.mapper.RoomMapper.toPlayerListResponse;
7-
import static io.f1.backend.domain.game.mapper.RoomMapper.toQuestionResultResponse;
8-
import static io.f1.backend.domain.game.mapper.RoomMapper.toQuestionStartResponse;
9-
import static io.f1.backend.domain.game.mapper.RoomMapper.toRankUpdateResponse;
107
import static io.f1.backend.domain.game.mapper.RoomMapper.toRoomResponse;
118
import static io.f1.backend.domain.game.mapper.RoomMapper.toRoomSetting;
129
import static io.f1.backend.domain.game.mapper.RoomMapper.toRoomSettingResponse;
1310
import static io.f1.backend.domain.game.websocket.WebSocketUtils.getDestination;
1411
import static io.f1.backend.global.util.SecurityUtils.getCurrentUserId;
1512
import static io.f1.backend.global.util.SecurityUtils.getCurrentUserNickname;
1613

17-
import io.f1.backend.domain.game.dto.ChatMessage;
1814
import io.f1.backend.domain.game.dto.MessageType;
1915
import io.f1.backend.domain.game.dto.RoomEventType;
2016
import io.f1.backend.domain.game.dto.request.RoomCreateRequest;
@@ -34,7 +30,6 @@
3430
import io.f1.backend.domain.game.model.RoomState;
3531
import io.f1.backend.domain.game.store.RoomRepository;
3632
import io.f1.backend.domain.game.websocket.MessageSender;
37-
import io.f1.backend.domain.question.entity.Question;
3833
import io.f1.backend.domain.quiz.app.QuizService;
3934
import io.f1.backend.domain.quiz.dto.QuizMinData;
4035
import io.f1.backend.domain.quiz.entity.Quiz;
@@ -312,12 +307,11 @@ public void exitRoomForDisconnectedPlayer(Long roomId, Player player, String ses
312307
String destination = getDestination(roomId);
313308

314309
SystemNoticeResponse systemNoticeResponse =
315-
ofPlayerEvent(player.nickname, RoomEventType.EXIT);
310+
ofPlayerEvent(player.nickname, RoomEventType.EXIT);
316311

317312
messageSender.send(destination, MessageType.PLAYER_LIST, toPlayerListResponse(room));
318313
messageSender.send(destination, MessageType.SYSTEM_NOTICE, systemNoticeResponse);
319314
}
320-
321315
}
322316

323317
public void handleDisconnectedPlayers(Room room, List<Player> disconnectedPlayers) {

backend/src/main/java/io/f1/backend/domain/game/app/TimerService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import io.f1.backend.domain.game.event.GameTimeoutEvent;
44
import io.f1.backend.domain.game.model.Room;
5-
import io.f1.backend.domain.game.websocket.MessageSender;
65

76
import lombok.RequiredArgsConstructor;
87

backend/src/main/java/io/f1/backend/domain/game/dto/response/QuestionStartResponse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,10 @@
22

33
import java.time.Instant;
44

5-
public record QuestionStartResponse(Long questionId, int round, Instant timestamp, int timeLimit, Instant serverTime, int totalRound) {}
5+
public record QuestionStartResponse(
6+
Long questionId,
7+
int round,
8+
Instant timestamp,
9+
int timeLimit,
10+
Instant serverTime,
11+
int totalRound) {}

backend/src/main/java/io/f1/backend/domain/game/event/GameCorrectAnswerEvent.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
import io.f1.backend.domain.game.dto.ChatMessage;
44
import io.f1.backend.domain.game.model.Room;
55

6-
public record GameCorrectAnswerEvent(Room room, String sessionId, ChatMessage chatMessage, String answer) {
7-
8-
}
6+
public record GameCorrectAnswerEvent(
7+
Room room, String sessionId, ChatMessage chatMessage, String answer) {}

backend/src/main/java/io/f1/backend/domain/game/event/GameTimeoutEvent.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22

33
import io.f1.backend.domain.game.model.Room;
44

5-
public record GameTimeoutEvent(Room room) {
6-
7-
}
5+
public record GameTimeoutEvent(Room room) {}

backend/src/main/java/io/f1/backend/domain/game/mapper/RoomMapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ public static GameResultListResponse toGameResultListResponse(
138138
return new GameResultListResponse(gameResults);
139139
}
140140

141-
private static List<GameResultResponse> buildRankedGameResults(List<Player> rankedPlayers, int round) {
141+
private static List<GameResultResponse> buildRankedGameResults(
142+
List<Player> rankedPlayers, int round) {
142143
int totalPlayers = rankedPlayers.size();
143144
int prevCorrectCnt = -1;
144145
int rank = 0;

backend/src/main/java/io/f1/backend/domain/game/model/Room.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,13 @@ public List<Player> getDisconnectedPlayers() {
107107
}
108108

109109
public void initializePlayers() {
110-
this.playerSessionMap.values().forEach(player -> {
111-
player.initializeCorrectCount();
112-
player.toggleReady();
113-
});
110+
this.playerSessionMap
111+
.values()
112+
.forEach(
113+
player -> {
114+
player.initializeCorrectCount();
115+
player.toggleReady();
116+
});
114117
}
115118

116119
public String getSessionIdByUserId(Long userId) {

0 commit comments

Comments
 (0)