fix: cannot reset room

This commit is contained in:
wzp 2024-12-19 12:41:12 +08:00
parent 79c6848e17
commit da60653963

View File

@ -156,12 +156,15 @@ public class Room {
public void requestRestart(Session session) {
String sessionId = session.getId();
if (sessionId.equals(whiteSession.getId())) {
if (whiteSession == null || sessionId.equals(whiteSession.getId())) {
isWhiteAcceptRestart = true;
}
if (sessionId.equals(blackSession.getId())) {
if (blackSession == null || sessionId.equals(blackSession.getId())) {
isBlackAcceptRestart = true;
}
if (isBlackAcceptRestart && isWhiteAcceptRestart) {
this.resetPieces();
}
}
public void replace(String existsUser, Session session) {