Skip to content

Commit

Permalink
lock的时候房主不能退出
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Dec 1, 2023
1 parent 8be8382 commit b848a42
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/kotlin/message/LeaveRoomCs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ class LeaveRoomCs : Handler {
val player = Store.getPlayer(token) ?: throw HandlerException("找不到玩家")
if (player.roomId.isNullOrEmpty()) throw HandlerException("不在房间里")
val room = Store.getRoom(player.roomId) ?: throw HandlerException("找不到房间")
if ((room.host == token || room.players.contains(token)) && room.started) throw HandlerException("比赛已经开始了,不能退出")
if (room.players.contains(token) && room.locked) throw HandlerException("连续比赛没结束,不能退出")
if (room.host == token || room.players.contains(token)) {
if (room.started) throw HandlerException("比赛已经开始了,不能退出")
if (room.locked) throw HandlerException("连续比赛没结束,不能退出")
}
val tokens = ArrayList<String>()
val roomDestroyed: Boolean
var isWatcher = false
Expand Down

0 comments on commit b848a42

Please sign in to comment.