diff --git a/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/ui/posted/game/DiceServerEditor.java b/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/ui/posted/game/DiceServerEditor.java index f2193c38a94..63c41b04a57 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/ui/posted/game/DiceServerEditor.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/ui/posted/game/DiceServerEditor.java @@ -10,6 +10,7 @@ import java.awt.GridBagLayout; import java.awt.Insets; import java.net.URI; +import java.util.Arrays; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -256,9 +257,9 @@ private void checkFieldsAndNotify() { public boolean areFieldsValid() { final boolean toValid = - !toAddress.getText().isEmpty() && PlayerEmailValidation.isValid(toAddress.getText()); + !toAddress.getText().isEmpty() && validateEmailAddresses(toAddress.getText()); final boolean ccValid = - !ccAddress.getText().isEmpty() && PlayerEmailValidation.isValid(ccAddress.getText()); + !ccAddress.getText().isEmpty() && validateEmailAddresses(ccAddress.getText()); final boolean allValid = toValid && ccValid; testDiceButton.setEnabled(allValid); @@ -275,6 +276,10 @@ public boolean areFieldsValid() { return allValid; } + private boolean validateEmailAddresses(String addresses) { + return Arrays.stream(addresses.split("\\s+")).allMatch(PlayerEmailValidation::isValid); + } + public void applyToGameProperties(final GameProperties properties) { properties.set(IRemoteDiceServer.GAME_NAME, gameId.getText()); properties.set(IRemoteDiceServer.EMAIL_1, toAddress.getText());