Fixed typesafe again and again

This commit is contained in:
huangyuhui
2017-02-24 12:57:18 +08:00
parent 44735b3d4e
commit 0bda79c0d5
7 changed files with 32 additions and 22 deletions

View File

@@ -56,9 +56,9 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
return downloadLibraries;
MinecraftVersion v = mv.resolve(service.version());
for (IMinecraftLibrary l : v.getLibraries())
if (l != null && l.allow() && l.getDownloadURL(service.getDownloadType().name()) != null) {
if (l != null && l.allow()) {
File ff = service.version().getLibraryFile(mv, l);
if (!ff.exists()) {
if (!ff.exists() && l.getDownloadURL(service.getDownloadType().name()) != null) {
String libURL = l.getDownloadURL(service.getDownloadType().name());
if (libURL != null)
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));

View File

@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.core.version;
import com.google.gson.annotations.SerializedName;
import org.jackhuang.hmcl.core.download.DownloadType;
import org.jackhuang.hmcl.util.StrUtils;
/**
*
@@ -58,7 +59,7 @@ public class GameDownloadInfo implements Cloneable {
* @return the download url
*/
public String getUrl(DownloadType dt, boolean allowSelf) {
if (url != null && allowSelf)
if (StrUtils.isNotBlank(url) && allowSelf)
return dt.getProvider().getParsedDownloadURL(url);
else
return getCustomizedURL(dt);

View File

@@ -35,14 +35,12 @@ public class LibraryDownloadInfo extends GameDownloadInfo {
@Override
public String getUrl(DownloadType dt, boolean allowSelf) {
String myURL = (forgeURL == null ? dt.getProvider().getLibraryDownloadURL() : forgeURL);
String myURL = dt.getProvider().getParsedDownloadURL(IOUtils.addURLSeparator(forgeURL == null ? dt.getProvider().getLibraryDownloadURL() : forgeURL) + path.replace('\\', '/'));
if (StrUtils.isNotBlank(url) && allowSelf)
myURL = dt.getProvider().getParsedDownloadURL(url);
if (!myURL.endsWith(".jar"))
if (path == null)
return null;
else
myURL = IOUtils.addURLSeparator(myURL) + path.replace('\\', '/');
return myURL;
}
}

View File

@@ -22,11 +22,9 @@ import com.google.gson.annotations.SerializedName;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import org.jackhuang.hmcl.api.HMCLApi;
import org.jackhuang.hmcl.util.sys.OS;
import org.jackhuang.hmcl.util.sys.Platform;
import org.jackhuang.hmcl.util.StrUtils;
import org.jackhuang.hmcl.api.Wrapper;
/**
*