Fixed handshake failed connecting with minecraft asset site

This commit is contained in:
huangyuhui
2017-01-26 15:07:57 +08:00
parent 574532f10c
commit 627e632120
19 changed files with 225 additions and 245 deletions

View File

@@ -64,7 +64,7 @@ public class MojangDownloadProvider extends IDownloadProvider {
@Override
public String getAssetsDownloadURL() {
return "https://resources.download.minecraft.net/";
return "http://resources.download.minecraft.net/";
}
@Override

View File

@@ -94,17 +94,23 @@ public class MinecraftModService extends IMinecraftModService {
}
@Override
public void removeMod(String id, Object[] rows) {
public boolean removeMod(String id, Object[] rows) {
if (rows.length == 0)
return;
return true;
boolean flag = true;
for (Object r : rows)
if (r instanceof ModInfo) {
if (!((ModInfo) r).location.delete())
if (!((ModInfo) r).location.delete()) {
HMCLog.warn("Failed to delete mod" + r);
flag = false;
}
} else if (r instanceof Number)
if (!getMods(id).get(((Number) r).intValue()).location.delete())
if (!getMods(id).get(((Number) r).intValue()).location.delete()) {
HMCLog.warn("Failed to delete mod " + r + ", maybe not a file?");
flag = false;
}
recacheMods(id);
return flag;
}
public String[] checkMd5s(String id) throws IOException {

View File

@@ -37,5 +37,5 @@ public abstract class IMinecraftModService extends IMinecraftBasicService {
public abstract boolean addMod(String id, File f);
public abstract void removeMod(String id, Object[] mods);
public abstract boolean removeMod(String id, Object[] mods);
}

View File

@@ -113,16 +113,16 @@ public class MinecraftVersionManager extends IMinecraftProvider {
try {
mcVersion = C.GSON.fromJson(FileUtils.read(jsonFile), MinecraftVersion.class);
if (mcVersion == null)
throw new GameException("Wrong json format, got null.");
} catch (JsonSyntaxException | IOException | GameException e) {
throw new JsonSyntaxException("Wrong json format, got null.");
} catch (JsonSyntaxException | IOException 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) {
service.download().downloadMinecraftVersionJson(id);
try {
mcVersion = C.GSON.fromJson(FileUtils.read(jsonFile), MinecraftVersion.class);
if (mcVersion == null)
throw new GameException("Wrong json format, got null.");
} catch (IOException | GameException | JsonSyntaxException ex) {
throw new JsonSyntaxException("Wrong json format, got null.");
} catch (IOException | JsonSyntaxException ex) {
HMCLog.warn("Ignoring: " + dir + ", the json of this Minecraft is malformed.", ex);
continue;
}

View File

@@ -129,7 +129,7 @@ public final class Main implements Runnable {
try {
File file = new File("hmcl.log");
if (!file.exists() && !file.createNewFile())
HMCLog.warn("Failed to create log file " + file);
LOGGER.log(Level.WARNING, "Failed to create log file {0}", file);
Configuration.DEFAULT.appenders.add(new ConsoleAppender("File", new DefaultLayout(), true, new FileOutputStream(file), true));
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "Failed to add log appender File because an error occurred while creating or opening hmcl.log", ex);
@@ -144,9 +144,6 @@ public final class Main implements Runnable {
Locale.setDefault(sl.self);
}
LogWindow.INSTANCE.clean();
LogWindow.INSTANCE.setTerminateGame(GameLauncher.PROCESS_MANAGER::stopAllProcesses);
try {
LOOK_AND_FEEL = new HelloMinecraftLookAndFeel(Settings.getInstance().getTheme().settings);
UIManager.setLookAndFeel(LOOK_AND_FEEL);
@@ -154,6 +151,9 @@ public final class Main implements Runnable {
} catch (ParseException | UnsupportedLookAndFeelException ex) {
HMCLog.warn("Failed to set look and feel...", ex);
}
LogWindow.INSTANCE.clean();
LogWindow.INSTANCE.setTerminateGame(GameLauncher.PROCESS_MANAGER::stopAllProcesses);
Settings.UPDATE_CHECKER.outOfDateEvent.register(IUpgrader.NOW_UPGRADER);
Settings.UPDATE_CHECKER.process(false).reg(t -> Main.invokeUpdate()).execute();

View File

@@ -132,7 +132,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
private static final HashSet<String> THROWABLE_SET = new HashSet<>();
void reportToServer(final String text, String stacktrace) {
if (THROWABLE_SET.contains(stacktrace) || stacktrace.contains("Font"))
if (THROWABLE_SET.contains(stacktrace) || stacktrace.contains("Font") || stacktrace.contains("InternalError"))
return;
THROWABLE_SET.add(stacktrace);
Thread t = new Thread(() -> {