Fixed BMCLAPI
This commit is contained in:
@@ -57,7 +57,7 @@ public class BMCLAPIDownloadProvider extends IDownloadProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersionsListDownloadURL() {
|
public String getVersionsListDownloadURL() {
|
||||||
return "http://bmclapi2.bangbang93.com/versions/versions.json";
|
return "http://bmclapi2.bangbang93.com/mc/game/version_manifest.json";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -66,13 +66,17 @@ public class BMCLAPIDownloadProvider extends IDownloadProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParsedLibraryDownloadURL(String str) {
|
public String getParsedDownloadURL(String str) {
|
||||||
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://bmclapi2.bangbang93.com/maven");
|
return str == null ? null
|
||||||
|
: str.replace("https://launchermeta.mojang.com", "http://bmclapi2.bangbang93.com")
|
||||||
|
.replace("https://launcher.mojang.com", "http://bmclapi2.bangbang93.com")
|
||||||
|
.replace("https://libraries.minecraft.net", "http://bmclapi2.bangbang93.com/libraries")
|
||||||
|
.replace("http://files.minecraftforge.net/maven", "http://bmclapi2.bangbang93.com/maven");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAllowedToUseSelfURL() {
|
public boolean isAllowedToUseSelfURL() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ package org.jackhuang.hellominecraft.launcher.core.download;
|
|||||||
public class CurseDownloadProvider extends MojangDownloadProvider {
|
public class CurseDownloadProvider extends MojangDownloadProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParsedLibraryDownloadURL(String str) {
|
public String getParsedDownloadURL(String str) {
|
||||||
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://ftb.cursecdn.com/FTB2/maven/");
|
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://ftb.cursecdn.com/FTB2/maven/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,15 @@ public abstract class IDownloadProvider {
|
|||||||
|
|
||||||
public abstract String getAssetsDownloadURL();
|
public abstract String getAssetsDownloadURL();
|
||||||
|
|
||||||
public abstract String getParsedLibraryDownloadURL(String str);
|
/**
|
||||||
|
* For example, minecraft.json/assetIndex/url or
|
||||||
|
* minecraft.json/downloads/client/url
|
||||||
|
*
|
||||||
|
* @param str baseURL
|
||||||
|
*
|
||||||
|
* @return parsedURL
|
||||||
|
*/
|
||||||
|
public abstract String getParsedDownloadURL(String str);
|
||||||
|
|
||||||
public abstract boolean isAllowedToUseSelfURL();
|
public abstract boolean isAllowedToUseSelfURL();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftDownloadServ
|
|||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -31,11 +32,9 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
|||||||
import org.jackhuang.hellominecraft.launcher.core.version.GameDownloadInfo;
|
import org.jackhuang.hellominecraft.launcher.core.version.GameDownloadInfo;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.version.IMinecraftLibrary;
|
import org.jackhuang.hellominecraft.launcher.core.version.IMinecraftLibrary;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||||
import org.jackhuang.hellominecraft.util.tasks.TaskWindow;
|
|
||||||
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
|
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
|
||||||
import org.jackhuang.hellominecraft.util.func.Function;
|
import org.jackhuang.hellominecraft.util.func.Function;
|
||||||
import org.jackhuang.hellominecraft.util.system.FileUtils;
|
import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||||
import org.jackhuang.hellominecraft.util.tasks.DoingDoneListener;
|
|
||||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||||
import org.jackhuang.hellominecraft.util.tasks.TaskInfo;
|
import org.jackhuang.hellominecraft.util.tasks.TaskInfo;
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
|||||||
if (l.allow()) {
|
if (l.allow()) {
|
||||||
File ff = l.getFilePath(service.baseDirectory());
|
File ff = l.getFilePath(service.baseDirectory());
|
||||||
if (!ff.exists()) {
|
if (!ff.exists()) {
|
||||||
String libURL = service.getDownloadType().getProvider().getParsedLibraryDownloadURL(l.getDownloadInfo().getUrl(service.getDownloadType()));
|
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
|
||||||
if (libURL != null)
|
if (libURL != null)
|
||||||
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
|
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
|
||||||
}
|
}
|
||||||
@@ -71,58 +70,31 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
|||||||
@Override
|
@Override
|
||||||
public Task downloadMinecraft(String id) {
|
public Task downloadMinecraft(String id) {
|
||||||
return new TaskInfo("Download Minecraft") {
|
return new TaskInfo("Download Minecraft") {
|
||||||
|
@Override
|
||||||
|
public Collection<Task> getDependTasks() {
|
||||||
|
return Arrays.asList(downloadMinecraftVersionJson(id));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeTask() throws Throwable {
|
public void executeTask() throws Throwable {
|
||||||
List<MinecraftRemoteVersion> versions = MinecraftRemoteVersions.getRemoteVersions(service.getDownloadType()).justDo();
|
|
||||||
MinecraftRemoteVersion currentVersion = null;
|
|
||||||
for (MinecraftRemoteVersion v : versions)
|
|
||||||
if (id.equals(v.id)) {
|
|
||||||
currentVersion = v;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (currentVersion == null)
|
|
||||||
throw new RuntimeException("Cannot find version: " + id + " in remote repository.");
|
|
||||||
String jsonURL = currentVersion.getUrl(service.getDownloadType());
|
|
||||||
File vpath = new File(service.baseDirectory(), "versions/" + id);
|
File vpath = new File(service.baseDirectory(), "versions/" + id);
|
||||||
File mvt = new File(vpath, id + ".json");
|
if (!areDependTasksSucceeded) {
|
||||||
|
FileUtils.deleteDirectory(vpath);
|
||||||
|
throw new RuntimeException("Cannot continue because of download failing.");
|
||||||
|
}
|
||||||
File mvj = new File(vpath, id + ".jar");
|
File mvj = new File(vpath, id + ".jar");
|
||||||
if (!vpath.exists() && !vpath.mkdirs())
|
|
||||||
HMCLog.warn("Failed to make directories: " + vpath);
|
|
||||||
if (mvt.exists() && !mvt.delete())
|
|
||||||
HMCLog.warn("Failed to delete " + mvt);
|
|
||||||
if (mvj.exists() && !mvj.delete())
|
if (mvj.exists() && !mvj.delete())
|
||||||
HMCLog.warn("Failed to delete " + mvj);
|
HMCLog.warn("Failed to delete " + mvj);
|
||||||
|
try {
|
||||||
|
MinecraftVersion mv = C.GSON.fromJson(FileUtils.readFileToStringQuietly(new File(vpath, id + ".json")), MinecraftVersion.class);
|
||||||
|
if (mv == null)
|
||||||
|
throw new JsonSyntaxException("incorrect version");
|
||||||
|
|
||||||
Task t = new FileDownloadTask(jsonURL, mvt).setTag(id + ".json");
|
afters.add(downloadMinecraftJar(mv, mvj));
|
||||||
t.addTaskListener(new DoingDoneListener<Task>() {
|
} catch (JsonSyntaxException ex) {
|
||||||
@Override
|
HMCLog.err("Failed to parse minecraft version json.", ex);
|
||||||
public void onDone(Task k, Collection<Task> taskCollection) {
|
FileUtils.deleteDirectory(vpath);
|
||||||
MinecraftVersion mv;
|
}
|
||||||
try {
|
|
||||||
mv = C.GSON.fromJson(FileUtils.readFileToStringQuietly(mvt), MinecraftVersion.class);
|
|
||||||
if (mv == null)
|
|
||||||
throw new JsonSyntaxException("incorrect version");
|
|
||||||
} catch (JsonSyntaxException ex) {
|
|
||||||
HMCLog.err("Failed to parse minecraft version json.", ex);
|
|
||||||
onFailed(k);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GameDownloadInfo i = mv.getClientDownloadInfo();
|
|
||||||
taskCollection.add(new FileDownloadTask(i.getUrl(service.getDownloadType()), mvj, i.sha1)
|
|
||||||
.setFailedCallbackReturnsNewURL(new DownloadTypeSwitcher(id + "/" + id + ".jar")).setTag(id + ".jar"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDoing(Task k, Collection<Task> taskCollection) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailed(Task k) {
|
|
||||||
FileUtils.deleteDirectoryQuietly(vpath);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
afters.add(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Collection<Task> afters = new HashSet<>();
|
Collection<Task> afters = new HashSet<>();
|
||||||
@@ -134,34 +106,6 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean downloadMinecraftJar(String id) {
|
|
||||||
String vurl = service.getDownloadType().getProvider().getVersionsDownloadURL() + id + "/";
|
|
||||||
File vpath = new File(service.baseDirectory(), "versions/" + id);
|
|
||||||
File mvv = new File(vpath, id + ".jar"), moved = null;
|
|
||||||
if (mvv.exists()) {
|
|
||||||
moved = new File(vpath, id + "-renamed.jar");
|
|
||||||
if (!mvv.renameTo(moved))
|
|
||||||
HMCLog.warn("Failed to rename " + mvv + " to " + moved);
|
|
||||||
}
|
|
||||||
File mvt = new File(vpath, id + ".jar");
|
|
||||||
if (!vpath.exists() && !vpath.mkdirs())
|
|
||||||
HMCLog.warn("Failed to make version folder " + vpath);
|
|
||||||
if (TaskWindow.factory()
|
|
||||||
.append(new FileDownloadTask(vurl + id + ".jar", mvt).setFailedCallbackReturnsNewURL(new DownloadTypeSwitcher(id + "/" + id + ".jar")).setTag(id + ".jar"))
|
|
||||||
.create()) {
|
|
||||||
if (moved != null && moved.exists() && !moved.delete())
|
|
||||||
HMCLog.warn("Failed to delete " + moved);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (mvt.exists() && !mvt.delete())
|
|
||||||
HMCLog.warn("Failed to delete game jar " + mvt);
|
|
||||||
if (moved != null && moved.exists() && !moved.renameTo(mvt))
|
|
||||||
HMCLog.warn("Failed to rename " + moved + " to " + mvt);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class DownloadTypeSwitcher implements Function<Integer, String> {
|
private static class DownloadTypeSwitcher implements Function<Integer, String> {
|
||||||
|
|
||||||
String suffix;
|
String suffix;
|
||||||
@@ -178,37 +122,43 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Task downloadMinecraftJarTo(MinecraftVersion mv, File mvt) {
|
public Task downloadMinecraftJar(MinecraftVersion mv, File mvj) {
|
||||||
String jar = mv.jar == null ? mv.id : mv.jar;
|
|
||||||
GameDownloadInfo i = mv.getClientDownloadInfo();
|
GameDownloadInfo i = mv.getClientDownloadInfo();
|
||||||
return new FileDownloadTask(i.getUrl(service.getDownloadType(), true), mvt, i.sha1).setTag(jar + ".jar");
|
return new FileDownloadTask(i.getUrl(service.getDownloadType()), mvj, i.sha1)
|
||||||
|
.setFailedCallbackReturnsNewURL(new DownloadTypeSwitcher(mv.id + "/" + mv.id + ".jar")).setTag(mv.id + ".jar");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean downloadMinecraftVersionJson(String id) {
|
public Task downloadMinecraftVersionJson(String id) {
|
||||||
String vurl = service.getDownloadType().getProvider().getVersionsDownloadURL() + id + "/";
|
return new TaskInfo("Download Minecraft Json") {
|
||||||
File vpath = new File(service.baseDirectory(), "versions/" + id);
|
@Override
|
||||||
File mvv = new File(vpath, id + ".json"), moved = null;
|
public void executeTask() throws Throwable {
|
||||||
if (mvv.exists()) {
|
List<MinecraftRemoteVersion> versions = MinecraftRemoteVersions.getRemoteVersions(service.getDownloadType()).justDo();
|
||||||
moved = new File(vpath, id + "-renamed.json");
|
MinecraftRemoteVersion currentVersion = null;
|
||||||
if (!mvv.renameTo(moved))
|
for (MinecraftRemoteVersion v : versions)
|
||||||
HMCLog.warn("Failed to rename " + mvv + " to " + moved);
|
if (id.equals(v.id)) {
|
||||||
}
|
currentVersion = v;
|
||||||
File mvt = new File(vpath, id + ".json");
|
break;
|
||||||
if (!vpath.exists() && !vpath.mkdirs())
|
}
|
||||||
HMCLog.warn("Failed to make version folder " + vpath);
|
if (currentVersion == null)
|
||||||
if (TaskWindow.factory()
|
throw new RuntimeException("Cannot find version: " + id + " in remote repository.");
|
||||||
.append(new FileDownloadTask(vurl + id + ".json", mvt).setTag(id + ".json"))
|
String jsonURL = currentVersion.getUrl(service.getDownloadType());
|
||||||
.create()) {
|
File vpath = new File(service.baseDirectory(), "versions/" + id);
|
||||||
if (moved != null && moved.exists() && !moved.delete())
|
File mvt = new File(vpath, id + ".json");
|
||||||
HMCLog.warn("Failed to delete " + moved);
|
if (!vpath.exists() && !vpath.mkdirs())
|
||||||
return true;
|
HMCLog.warn("Failed to make directories: " + vpath);
|
||||||
} else {
|
if (mvt.exists() && !mvt.delete())
|
||||||
if (mvt.exists() && !mvt.delete())
|
HMCLog.warn("Failed to delete " + mvt);
|
||||||
HMCLog.warn("Failed to delete minecraft version json" + mvt);
|
|
||||||
if (moved != null && moved.exists() && !moved.renameTo(mvt))
|
afters.add(new FileDownloadTask(jsonURL, mvt).setTag(id + ".json"));
|
||||||
HMCLog.warn("Failed to rename " + moved + " to " + mvt);
|
}
|
||||||
return false;
|
|
||||||
}
|
Collection<Task> afters = new HashSet<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<Task> getAfterTasks() {
|
||||||
|
return afters;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class MojangDownloadProvider extends IDownloadProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParsedLibraryDownloadURL(String str) {
|
public String getParsedDownloadURL(String str) {
|
||||||
if (str == null)
|
if (str == null)
|
||||||
return null;
|
return null;
|
||||||
else if (str.contains("scala-swing") || str.contains("scala-xml") || str.contains("scala-parser-combinators"))
|
else if (str.contains("scala-swing") || str.contains("scala-xml") || str.contains("scala-parser-combinators"))
|
||||||
@@ -86,5 +86,4 @@ public class MojangDownloadProvider extends IDownloadProvider {
|
|||||||
else
|
else
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public class RapidDataDownloadProvider extends MojangDownloadProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getParsedLibraryDownloadURL(String str) {
|
public String getParsedDownloadURL(String str) {
|
||||||
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://mirrors.rapiddata.org/forge/maven");
|
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://mirrors.rapiddata.org/forge/maven");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public final class MinecraftInstallerService extends IMinecraftInstallerService
|
|||||||
File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "forge-installer.jar");
|
File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "forge-installer.jar");
|
||||||
if (v.installer != null)
|
if (v.installer != null)
|
||||||
TaskWindow.factory()
|
TaskWindow.factory()
|
||||||
.append(new FileDownloadTask(service.getDownloadType().getProvider().getParsedLibraryDownloadURL(v.installer), filepath).setTag("forge"))
|
.append(new FileDownloadTask(service.getDownloadType().getProvider().getParsedDownloadURL(v.installer), filepath).setTag("forge"))
|
||||||
.append(new ForgeInstaller(service, filepath))
|
.append(new ForgeInstaller(service, filepath))
|
||||||
.create();
|
.create();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
|||||||
public void refreshList(String[] needed) throws Exception {
|
public void refreshList(String[] needed) throws Exception {
|
||||||
if (root != null)
|
if (root != null)
|
||||||
return;
|
return;
|
||||||
String s = NetUtils.get(DownloadType.getSuggestedDownloadType().getProvider().getParsedLibraryDownloadURL(C.URL_FORGE_LIST));
|
String s = NetUtils.get(DownloadType.getSuggestedDownloadType().getProvider().getParsedDownloadURL(C.URL_FORGE_LIST));
|
||||||
|
|
||||||
root = C.GSON.fromJson(s, MinecraftForgeVersionRoot.class);
|
root = C.GSON.fromJson(s, MinecraftForgeVersionRoot.class);
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
|||||||
if (!StrUtils.isBlank(v.branch))
|
if (!StrUtils.isBlank(v.branch))
|
||||||
ver = ver + "-" + v.branch;
|
ver = ver + "-" + v.branch;
|
||||||
String filename = root.artifact + "-" + ver + "-" + f[1] + "." + f[0];
|
String filename = root.artifact + "-" + ver + "-" + f[1] + "." + f[0];
|
||||||
String url = DownloadType.getSuggestedDownloadType().getProvider().getParsedLibraryDownloadURL(root.webpath + ver + "/" + filename);
|
String url = DownloadType.getSuggestedDownloadType().getProvider().getParsedDownloadURL(root.webpath + ver + "/" + filename);
|
||||||
switch (f[1]) {
|
switch (f[1]) {
|
||||||
case "installer":
|
case "installer":
|
||||||
iv.installer = url;
|
iv.installer = url;
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public final class ModpackManager {
|
|||||||
if (mv.jar == null)
|
if (mv.jar == null)
|
||||||
throw new FileNotFoundException(C.i18n("modpack.incorrect_format.no_jar"));
|
throw new FileNotFoundException(C.i18n("modpack.incorrect_format.no_jar"));
|
||||||
|
|
||||||
c.add(service.download().downloadMinecraftJarTo(mv, new File(nowFile, id + ".jar")));
|
c.add(service.download().downloadMinecraftJar(mv, new File(nowFile, id + ".jar")));
|
||||||
mv.jar = null;
|
mv.jar = null;
|
||||||
FileUtils.writeStringToFile(json, C.GSON.toJson(mv));
|
FileUtils.writeStringToFile(json, C.GSON.toJson(mv));
|
||||||
if (!json.renameTo(new File(nowFile, id + ".json")))
|
if (!json.renameTo(new File(nowFile, id + ".json")))
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ import java.util.List;
|
|||||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadLibraryJob;
|
import org.jackhuang.hellominecraft.launcher.core.download.DownloadLibraryJob;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||||
import org.jackhuang.hellominecraft.util.OverridableSwingWorker;
|
|
||||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||||
import org.jackhuang.hellominecraft.launcher.core.download.MinecraftRemoteVersion;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -38,11 +36,9 @@ public abstract class IMinecraftDownloadService extends IMinecraftBasicService {
|
|||||||
|
|
||||||
public abstract Task downloadMinecraft(String id);
|
public abstract Task downloadMinecraft(String id);
|
||||||
|
|
||||||
public abstract boolean downloadMinecraftJar(String id);
|
public abstract Task downloadMinecraftJar(MinecraftVersion mv, File f);
|
||||||
|
|
||||||
public abstract Task downloadMinecraftJarTo(MinecraftVersion mv, File f);
|
public abstract Task downloadMinecraftVersionJson(String id);
|
||||||
|
|
||||||
public abstract boolean downloadMinecraftVersionJson(String id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the libraries that need to download.
|
* Get the libraries that need to download.
|
||||||
|
|||||||
@@ -36,11 +36,8 @@ public class AssetIndexDownloadInfo extends GameDownloadInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUrl(DownloadType dt, boolean allowSelf) {
|
public String getCustomizedURL(DownloadType dt) {
|
||||||
if (url != null && dt.getProvider().isAllowedToUseSelfURL())
|
return dt.getProvider().getIndexesDownloadURL() + id + ".json";
|
||||||
return url;
|
|
||||||
else
|
|
||||||
return dt.getProvider().getIndexesDownloadURL() + id + ".json";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|||||||
@@ -55,9 +55,13 @@ public class GameDownloadInfo implements Cloneable {
|
|||||||
*/
|
*/
|
||||||
public String getUrl(DownloadType dt, boolean allowSelf) {
|
public String getUrl(DownloadType dt, boolean allowSelf) {
|
||||||
if (url != null && allowSelf)
|
if (url != null && allowSelf)
|
||||||
return url;
|
return dt.getProvider().getParsedDownloadURL(url);
|
||||||
else
|
else
|
||||||
return dt.getProvider().getVersionsDownloadURL() + id + "/" + id + ".jar";
|
return getCustomizedURL(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getCustomizedURL(DownloadType dt) {
|
||||||
|
return dt.getProvider().getVersionsDownloadURL() + id + "/" + id + ".jar";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -388,43 +388,40 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="103" alignment="0" groupAlignment="0" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Component id="txtWrapperLauncher" alignment="0" max="32767" attributes="0"/>
|
||||||
<Component id="txtWrapperLauncher" alignment="0" max="32767" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Component id="lblPrecalledCommand1" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="lblPrecalledCommand1" min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="txtPrecalledCommand" alignment="0" max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="txtServerIP" alignment="0" max="32767" attributes="0"/>
|
</Group>
|
||||||
<Group type="102" attributes="0">
|
<Component id="txtPrecalledCommand" alignment="0" max="32767" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Component id="txtServerIP" alignment="0" max="32767" attributes="0"/>
|
||||||
<Component id="lblPrecalledCommand" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Component id="lblServerIP" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
</Group>
|
<Component id="lblMinecraftArgs" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="716" max="32767" attributes="0"/>
|
<Component id="lblPermSize" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="lblJavaArgs" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="lblMinecraftArgs" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="txtJavaArgs" pref="664" max="32767" attributes="0"/>
|
||||||
<Component id="lblPermSize" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="txtMinecraftArgs" max="32767" attributes="0"/>
|
||||||
<Component id="lblJavaArgs" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="txtPermSize" alignment="1" max="32767" attributes="0"/>
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="txtJavaArgs" max="32767" attributes="0"/>
|
|
||||||
<Component id="txtMinecraftArgs" max="32767" attributes="0"/>
|
|
||||||
<Component id="txtPermSize" alignment="1" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
<Component id="lblPrecalledCommand" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="lblServerIP" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
|||||||
@@ -1376,10 +1376,12 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
|||||||
final Runnable onLoadingProfiles = this::loadProfiles;
|
final Runnable onLoadingProfiles = this::loadProfiles;
|
||||||
|
|
||||||
private void loadProfiles() {
|
private void loadProfiles() {
|
||||||
|
isLoading = true;
|
||||||
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
||||||
for (Profile s : Settings.getProfilesFiltered())
|
for (Profile s : Settings.getProfilesFiltered())
|
||||||
model.addElement(s.getName());
|
model.addElement(s.getName());
|
||||||
cboProfiles.setModel(model);
|
cboProfiles.setModel(model);
|
||||||
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Consumer<IMinecraftService> onRefreshedVersions = t -> {
|
final Consumer<IMinecraftService> onRefreshedVersions = t -> {
|
||||||
@@ -1425,12 +1427,15 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
|||||||
t.selectedVersionChangedEvent.register(selectedVersionChangedEvent);
|
t.selectedVersionChangedEvent.register(selectedVersionChangedEvent);
|
||||||
|
|
||||||
txtGameDir.setText(t.getGameDir());
|
txtGameDir.setText(t.getGameDir());
|
||||||
|
|
||||||
|
isLoading = true;
|
||||||
DefaultComboBoxModel model = (DefaultComboBoxModel) cboProfiles.getModel();
|
DefaultComboBoxModel model = (DefaultComboBoxModel) cboProfiles.getModel();
|
||||||
for (int i = 0; i < model.getSize(); ++i)
|
for (int i = 0; i < model.getSize(); ++i)
|
||||||
if (model.getElementAt(i).equals(t.getName())) {
|
if (model.getElementAt(i).equals(t.getName())) {
|
||||||
model.setSelectedItem(t.getName());
|
model.setSelectedItem(t.getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
isLoading = false;
|
||||||
};
|
};
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -472,10 +472,12 @@ public class MainPagePanel extends AnimatedPanel {
|
|||||||
final Runnable onLoadingProfiles = this::loadProfiles;
|
final Runnable onLoadingProfiles = this::loadProfiles;
|
||||||
|
|
||||||
private void loadProfiles() {
|
private void loadProfiles() {
|
||||||
|
isLoading = true;
|
||||||
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
||||||
for (Profile s : Settings.getProfilesFiltered())
|
for (Profile s : Settings.getProfilesFiltered())
|
||||||
model.addElement(s.getName());
|
model.addElement(s.getName());
|
||||||
cboProfiles.setModel(model);
|
cboProfiles.setModel(model);
|
||||||
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Consumer<IMinecraftService> onRefreshedVersions = t -> {
|
final Consumer<IMinecraftService> onRefreshedVersions = t -> {
|
||||||
@@ -529,11 +531,13 @@ public class MainPagePanel extends AnimatedPanel {
|
|||||||
t.selectedVersionChangedEvent.register(versionChanged);
|
t.selectedVersionChangedEvent.register(versionChanged);
|
||||||
t.launcher().launchingStateChanged.register(launchingStateChanged);
|
t.launcher().launchingStateChanged.register(launchingStateChanged);
|
||||||
|
|
||||||
|
isLoading = true;
|
||||||
DefaultComboBoxModel model = (DefaultComboBoxModel) cboProfiles.getModel();
|
DefaultComboBoxModel model = (DefaultComboBoxModel) cboProfiles.getModel();
|
||||||
for (int i = 0; i < model.getSize(); ++i)
|
for (int i = 0; i < model.getSize(); ++i)
|
||||||
if (model.getElementAt(i).equals(t.getName())) {
|
if (model.getElementAt(i).equals(t.getName())) {
|
||||||
model.setSelectedItem(t.getName());
|
model.setSelectedItem(t.getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
isLoading = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher.
|
||||||
|
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hellominecraft.util.tasks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author huangyuhui
|
||||||
|
*/
|
||||||
|
public class NoShownTaskException extends RuntimeException {
|
||||||
|
|
||||||
|
public NoShownTaskException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user