From 5bcf651b00cb15210074b20a44aa63ad61ff47b7 Mon Sep 17 00:00:00 2001 From: Dan Van Atta <dhvatta@gmail.com> Date: Sun, 21 Jul 2024 17:16:07 -0700 Subject: [PATCH] Simplify: inline constructor parameter (#12743) --- .../engine/framework/network/ui/SetMapClientAction.java | 8 +++----- .../strategy/engine/framework/startup/mc/ClientModel.java | 7 +------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/game-app/game-core/src/main/java/games/strategy/engine/framework/network/ui/SetMapClientAction.java b/game-app/game-core/src/main/java/games/strategy/engine/framework/network/ui/SetMapClientAction.java index e969940fe1..2c8583f3b5 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/framework/network/ui/SetMapClientAction.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/framework/network/ui/SetMapClientAction.java @@ -3,7 +3,6 @@ import com.google.common.base.Preconditions; import games.strategy.engine.framework.startup.mc.IServerStartupRemote; import java.awt.Component; -import java.util.Collection; import java.util.List; import java.util.stream.Collectors; import javax.swing.DefaultComboBoxModel; @@ -20,12 +19,11 @@ public class SetMapClientAction { private final IServerStartupRemote serverStartupRemote; public SetMapClientAction( - final Component parent, - final IServerStartupRemote serverStartupRemote, - final Collection<String> games) { + final Component parent, final IServerStartupRemote serverStartupRemote) { this.parent = JOptionPane.getFrameForComponent(parent); this.serverStartupRemote = serverStartupRemote; - this.availableGames = games.stream().sorted().collect(Collectors.toList()); + this.availableGames = + serverStartupRemote.getAvailableGames().stream().sorted().collect(Collectors.toList()); } public void run() { diff --git a/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/mc/ClientModel.java b/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/mc/ClientModel.java index e86f79b35c..5ca9b532ad 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/mc/ClientModel.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/framework/startup/mc/ClientModel.java @@ -300,10 +300,6 @@ private IServerStartupRemote getServerStartup() { return (IServerStartupRemote) messengers.getRemote(ServerModel.SERVER_REMOTE_NAME); } - private Collection<String> getAvailableServerGames() { - return getServerStartup().getAvailableGames(); - } - /** Resets stats and nulls out references, keeps chat alive. */ public void cancel() { gameSelectorModel.setGameData(gameDataOnStartup); @@ -465,8 +461,7 @@ public void setMap(final Component parent) { Preconditions.checkState(SwingUtilities.isEventDispatchThread(), "Should be run on EDT!"); ThreadRunner.runInNewThread( () -> { - final var action = - new SetMapClientAction(parent, getServerStartup(), getAvailableServerGames()); + final var action = new SetMapClientAction(parent, getServerStartup()); SwingUtilities.invokeLater(action::run); }); }