Skip to content

Commit 9372021

Browse files
committed
Revert "Add reload version list button when version list fails to load"
This reverts commit b17546c.
1 parent b17546c commit 9372021

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

cli/src/main/java/org/mcphackers/mcp/main/MainCLI.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public MainCLI(String[] args) {
103103
mode = TaskMode.EXIT;
104104
} else {
105105
str = str.trim();
106-
if (str.isEmpty()) {
106+
if (str.length() == 0) {
107107
continue;
108108
}
109109
System.out.print(new Ansi().fgDefault());
@@ -323,7 +323,6 @@ public void showMessage(String title, String msg, int type) {
323323
log("[" + typeName + "]: " + msg);
324324
}
325325

326-
@SuppressWarnings("CallToPrintStackTrace")
327326
@Override
328327
public void showMessage(String title, String msg, Throwable e) {
329328
Ansi typeName = new Ansi().fgRed().a("ERROR").fgDefault();

gui/src/main/java/org/mcphackers/mcp/gui/MCPFrame.java

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class MCPFrame extends JFrame implements WindowListener {
5050
private final List<TaskButton> buttons = new ArrayList<>();
5151
public MenuBar menuBar;
5252
public boolean loadingVersions = true;
53-
private JComponent verList;
53+
private JComboBox<?> verList;
5454
private JLabel verLabel;
5555
//private JButton verCleanup;
5656
private JPanel topRightContainer;
@@ -143,13 +143,9 @@ public void reloadVersionList() {
143143
verLabel = new JLabel(MCP.TRANSLATOR.translateKey("mcp.versionList.failure"));
144144
verLabel.setBorder(new EmptyBorder(4, 0, 0, 2));
145145
verLabel.setForeground(Color.RED);
146-
JButton verList = new JButton(MCP.TRANSLATOR.translateKey("mcp.versionList.reloadVersionList"));
147-
verList.addActionListener(e -> {
148-
reloadVersionList();
149-
});
150-
this.verList = verList;
146+
verList = null;
151147
} else {
152-
JComboBox<?> verList = new JComboBox<>(versionParser.getVersions().toArray());
148+
verList = new JComboBox<>(versionParser.getVersions().toArray());
153149
verList.addPopupMenuListener(new PopupMenuListener() {
154150

155151
@Override
@@ -169,7 +165,6 @@ public void popupMenuCanceled(PopupMenuEvent e) {
169165
setCurrentVersion(mcp.currentVersion == null ? null : versionParser.getVersion(mcp.currentVersion.id));
170166
verList.setMaximumRowCount(20);
171167
verLabel = new JLabel(MCP.TRANSLATOR.translateKey("mcp.versionList.currentVersion"));
172-
this.verList = verList;
173168
}
174169
topRightContainer.removeAll();
175170
topRightContainer.add(this.verLabel);
@@ -231,11 +226,8 @@ public void setCurrentVersion(VersionData versionData) {
231226
if (verList == null) {
232227
return;
233228
}
234-
if (this.verList instanceof JComboBox) {
235-
JComboBox<?> verList = (JComboBox<?>) this.verList;
236-
verList.setSelectedItem(versionData);
237-
verList.repaint();
238-
}
229+
verList.setSelectedItem(versionData);
230+
verList.repaint();
239231
}
240232

241233
/**

src/main/resources/lang/en_US.lang

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ mcp.incompatiblePlugin = Incompatible plugin found:
1414
mcp.versionList.currentVersion = Current version:
1515
mcp.versionList.failure = Unable to get version list!
1616
mcp.versionList.loading = Loading...
17-
mcp.versionList.reloadVersionList = Reload version list
1817
mcp.checkUpdate = Check for updates
1918
mcp.upToDate = Up to date!
2019
mcp.viewDir = View working directory

0 commit comments

Comments
 (0)