Skip to content

Commit

Permalink
Simplify: inline constructor parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
DanVanAtta committed Jul 22, 2024
1 parent 407c355 commit f556e74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
});
}
Expand Down

0 comments on commit f556e74

Please sign in to comment.