diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java index b4705cd8b..12d9d3b9d 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/version/MinecraftVersionManager.java @@ -63,7 +63,6 @@ public class MinecraftVersionManager extends IMinecraftProvider { mms = new MinecraftModService(p, this); mds = new MinecraftDownloadService(p, this); mas = new MinecraftAssetService(p, this); - refreshVersions(); } public File getFolder() { @@ -128,17 +127,16 @@ public class MinecraftVersionManager extends IMinecraftProvider { try { mcVersion = C.gson.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class); if (mcVersion == null) - throw new RuntimeException("Wrong json format, got null."); - } catch (IOException | RuntimeException e) { + throw new GameException("Wrong json format, got null."); + } catch (IOException | GameException e) { HMCLog.warn("Found wrong format json, try to fix it.", e); if (MessageBox.Show(C.i18n("launcher.versions_json_not_formatted", id), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) { refreshJson(id); try { mcVersion = C.gson.fromJson(FileUtils.readFileToString(jsonFile), MinecraftVersion.class); if (mcVersion == null) - throw new RuntimeException("Wrong json format, got null."); - } catch (IOException | RuntimeException ex) { - HMCLog.err("Retried but still failed."); + throw new GameException("Wrong json format, got null."); + } catch (IOException | GameException ex) { HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", ex); continue; } @@ -147,7 +145,7 @@ public class MinecraftVersionManager extends IMinecraftProvider { } try { if (!id.equals(mcVersion.id)) { - HMCLog.warn("Found: " + dir + ", it contains id: " + mcVersion.id + ", expected: " + id + ", the launcher will fix this problem."); + HMCLog.warn("Found: " + dir + ", it contains id: " + mcVersion.id + ", expected: " + id + ", this app will fix this problem."); mcVersion.id = id; FileUtils.writeQuietly(jsonFile, C.gsonPrettyPrinting.toJson(mcVersion)); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java index 52f0d44c2..0391117c3 100755 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java @@ -884,8 +884,11 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget }// //GEN-END:initComponents // private void cboProfilesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboProfilesItemStateChanged - if (!isLoading) - onSelected(); + if (!isLoading) { + if (getProfile().getMinecraftProvider().getVersionCount() <= 0) + versionChanged(null); + prepare(getProfile()); + } }//GEN-LAST:event_cboProfilesItemStateChanged private void btnNewProfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewProfileActionPerformed diff --git a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/views/LogWindow.java b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/views/LogWindow.java index 53a26c15d..8bd4faa75 100755 --- a/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/views/LogWindow.java +++ b/HMCLAPI/src/main/java/org/jackhuang/hellominecraft/views/LogWindow.java @@ -259,7 +259,7 @@ public class LogWindow extends javax.swing.JFrame { log(status, Level.WARN); } - public void log(String status, Level c) { + public synchronized void log(String status, Level c) { status = status.replace("\t", " "); Document d = txtLog.getStyledDocument(); SimpleAttributeSet sas = new SimpleAttributeSet();