Fix problems with launching
This commit is contained in:
@@ -27,7 +27,6 @@ import java.net.URL;
|
|||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogManager;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import org.jackhuang.hellominecraft.util.C;
|
import org.jackhuang.hellominecraft.util.C;
|
||||||
@@ -47,7 +46,7 @@ import org.jackhuang.hellominecraft.util.Utils;
|
|||||||
*/
|
*/
|
||||||
public final class Launcher {
|
public final class Launcher {
|
||||||
|
|
||||||
static final Logger LOGGER = LogManager.getLogManager().getLogger(Launcher.class.getName());
|
static final Logger LOGGER = Logger.getLogger(Launcher.class.getName());
|
||||||
|
|
||||||
static String classPath = "", proxyHost = "", proxyPort = "", proxyUsername = "", proxyPassword = "";
|
static String classPath = "", proxyHost = "", proxyPort = "", proxyUsername = "", proxyPassword = "";
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
|||||||
|
|
||||||
if (!checkAssetsExist())
|
if (!checkAssetsExist())
|
||||||
if (MessageBox.Show(C.i18n("assets.no_assets"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
|
if (MessageBox.Show(C.i18n("assets.no_assets"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
|
||||||
IAssetsHandler.ASSETS_HANDLER.getList(version, service.asset()).execute();
|
IAssetsHandler.ASSETS_HANDLER.getList(version, service.asset()).run();
|
||||||
TaskWindow.getInstance().addTask(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(service.getDownloadType().getProvider())).start();
|
TaskWindow.getInstance().addTask(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(service.getDownloadType().getProvider())).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,17 +52,7 @@ public class DefaultMinecraftService extends IMinecraftService {
|
|||||||
this.provider = new HMCLGameProvider(this);
|
this.provider = new HMCLGameProvider(this);
|
||||||
provider.initializeMiencraft();
|
provider.initializeMiencraft();
|
||||||
provider.onRefreshingVersions.register(versionSettings::clear);
|
provider.onRefreshingVersions.register(versionSettings::clear);
|
||||||
provider.onLoadedVersion.register(id -> {
|
provider.onLoadedVersion.register(this::loadVersionSetting);
|
||||||
VersionSetting vs = new VersionSetting();
|
|
||||||
File f = new File(provider.versionRoot(id), "hmclversion.cfg");
|
|
||||||
if (f.exists()) {
|
|
||||||
String s = FileUtils.readFileToStringQuietly(f);
|
|
||||||
if (s != null)
|
|
||||||
vs = C.GSON.fromJson(s, VersionSetting.class);
|
|
||||||
}
|
|
||||||
vs.id = id;
|
|
||||||
versionSettings.put(id, vs);
|
|
||||||
});
|
|
||||||
this.mms = new MinecraftModService(this);
|
this.mms = new MinecraftModService(this);
|
||||||
this.mds = new MinecraftDownloadService(this);
|
this.mds = new MinecraftDownloadService(this);
|
||||||
this.mas = new MinecraftAssetService(this);
|
this.mas = new MinecraftAssetService(this);
|
||||||
@@ -77,7 +67,23 @@ public class DefaultMinecraftService extends IMinecraftService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadVersionSetting(String id) {
|
||||||
|
if (provider.getVersionById(id) == null)
|
||||||
|
return;
|
||||||
|
VersionSetting vs = new VersionSetting();
|
||||||
|
File f = new File(provider.versionRoot(id), "hmclversion.cfg");
|
||||||
|
if (f.exists()) {
|
||||||
|
String s = FileUtils.readFileToStringQuietly(f);
|
||||||
|
if (s != null)
|
||||||
|
vs = C.GSON.fromJson(s, VersionSetting.class);
|
||||||
|
}
|
||||||
|
vs.id = id;
|
||||||
|
versionSettings.put(id, vs);
|
||||||
|
}
|
||||||
|
|
||||||
public VersionSetting getVersionSetting(String id) {
|
public VersionSetting getVersionSetting(String id) {
|
||||||
|
if (!versionSettings.containsKey(id))
|
||||||
|
loadVersionSetting(id);
|
||||||
return versionSettings.get(id);
|
return versionSettings.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,9 +69,10 @@ public final class Profile {
|
|||||||
|
|
||||||
public VersionSetting getSelectedVersionSetting() {
|
public VersionSetting getSelectedVersionSetting() {
|
||||||
String s = getSelectedVersion();
|
String s = getSelectedVersion();
|
||||||
if (s == null)
|
VersionSetting vs = defaultVersionSetting;
|
||||||
return defaultVersionSetting;
|
if (s != null)
|
||||||
return getVersionSetting(getSelectedVersion());
|
vs = getVersionSetting(getSelectedVersion());
|
||||||
|
return vs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VersionSetting getVersionSetting(String id) {
|
public VersionSetting getVersionSetting(String id) {
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.LogManager;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import org.jackhuang.hellominecraft.util.C;
|
import org.jackhuang.hellominecraft.util.C;
|
||||||
@@ -42,7 +41,7 @@ import org.jackhuang.hellominecraft.util.ui.LogWindow;
|
|||||||
*/
|
*/
|
||||||
public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogManager().getLogger(CrashReporter.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(CrashReporter.class.getName());
|
||||||
|
|
||||||
boolean enableLogger = false;
|
boolean enableLogger = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user