mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Prevent starting a game with less than two players
This commit is contained in:
@@ -288,10 +288,6 @@ public abstract class GameLobby {
|
||||
|
||||
/** Returns a runnable to start a match with the applied variants if allowed. */
|
||||
public Runnable startGame() {
|
||||
if (!isEnoughTeams()) {
|
||||
SOptionPane.showMessageDialog("There are not enough teams! Please adjust team allocations.");
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<LobbySlot> activeSlots = Lists.newArrayListWithCapacity(getNumberOfSlots());
|
||||
for (final LobbySlot slot : data.slots) {
|
||||
@@ -300,6 +296,16 @@ public abstract class GameLobby {
|
||||
}
|
||||
}
|
||||
|
||||
if (activeSlots.size() < 2) {
|
||||
SOptionPane.showMessageDialog("At least two players are required to start a game.");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isEnoughTeams()) {
|
||||
SOptionPane.showMessageDialog("There are not enough teams! Please adjust team allocations.");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (final LobbySlot slot : activeSlots) {
|
||||
if (!slot.isReady() && slot.getType() != LobbySlotType.OPEN) {
|
||||
SOptionPane.showMessageDialog(String.format("Player %s is not ready", slot.getName()));
|
||||
|
||||
Reference in New Issue
Block a user