Skip to content

Commit 39738fc

Browse files
committed
✨ 방장은 입장 시 ready=true
1 parent 3fe0628 commit 39738fc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ public RoomInitialData initializeRoomSocket(Long roomId, String sessionId) {
116116
Map<String, Player> playerSessionMap = room.getPlayerSessionMap();
117117
Map<Long, String> userIdSessionMap = room.getUserIdSessionMap();
118118

119+
if(room.isHost(player.getId())) {
120+
player.toggleReady();
121+
}
122+
119123
playerSessionMap.put(sessionId, player);
120124
String existingSession = userIdSessionMap.get(player.getId());
121125
/* 정상 흐름 or 재연결 */

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ public Player(Long id, String nickname) {
1919
this.id = id;
2020
this.nickname = nickname;
2121
}
22+
23+
public void toggleReady() {
24+
this.isReady = !this.isReady;
25+
}
2226
}

0 commit comments

Comments
 (0)