fix: fixed bug where selectionComplete is always false
This commit is contained in:
parent
752f43b86f
commit
a25b429e1e
@ -256,17 +256,13 @@ public class LobbyConnection implements Runnable {
|
||||
selectionPossibilities.item1,
|
||||
message.characters);
|
||||
Logger.info("Player 1 has selected their characters");
|
||||
Logger.trace("Sending selection confirmation message to Player1");
|
||||
|
||||
Logger.trace("Sending confirmSelectionMessage to player1");
|
||||
var replyMessage = new ConfirmSelectionMessage();
|
||||
replyMessage.selectionComplete = !characterSelectionActive;
|
||||
replyMessage.selectionComplete = !characterSelectionInProgress();
|
||||
sendMessage(origin, replyMessage);
|
||||
} else {
|
||||
Logger.debug("Player 1 tried to select characters twice, sending error");
|
||||
sendError(origin,
|
||||
"Cannot select characters as characters were already selected"
|
||||
);
|
||||
sendError(origin, "Cannot select characters as characters were already selected");
|
||||
}
|
||||
}
|
||||
case PlayerTwo -> {
|
||||
@ -278,7 +274,7 @@ public class LobbyConnection implements Runnable {
|
||||
|
||||
Logger.trace("Sending confirmSelectionMessage to player2");
|
||||
var replyMessage = new ConfirmSelectionMessage();
|
||||
replyMessage.selectionComplete = !characterSelectionActive;
|
||||
replyMessage.selectionComplete = !characterSelectionInProgress();
|
||||
sendMessage(origin, replyMessage);
|
||||
} else {
|
||||
Logger.debug("Player 2 tried to select characters twice, sending error");
|
||||
@ -297,6 +293,11 @@ public class LobbyConnection implements Runnable {
|
||||
"the CharacterSelectionPhase, sending error", origin.name);
|
||||
sendError(origin, "The character selection phase is already over");
|
||||
}
|
||||
return characterSelectionInProgress();
|
||||
}
|
||||
|
||||
/** Returns whether the character selection is not yet done */
|
||||
private boolean characterSelectionInProgress() {
|
||||
return (playerOneSelection == null || playerTwoSelection == null) && characterSelectionActive;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user