Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c15ec71be9 | ||
|
|
93273d555d | ||
|
|
793f81e287 | ||
|
|
d87b768fc0 | ||
|
|
c07d2dc6d3 | ||
|
|
95af0222f3 | ||
|
|
3f15eddb0c | ||
|
|
c39f1ad75f | ||
|
|
f27b60e031 | ||
|
|
5f1d0a5936 | ||
|
|
4fdadd5474 | ||
|
|
b2ea6d449e | ||
|
|
3afff687b2 | ||
|
|
37ddecf629 | ||
|
|
27e58edb1f | ||
|
|
3dd421a2bf | ||
|
|
4537f9e48f | ||
|
|
94b6cda86e | ||
|
|
9ae010a391 | ||
|
|
13c105472e | ||
|
|
88194e479e | ||
|
|
b36c194f67 | ||
|
|
7c7b6e0fd9 | ||
|
|
01b77f1f5f | ||
|
|
840a0ad840 | ||
|
|
ab1ca18488 | ||
|
|
75e0fa2def | ||
|
|
ca3ed47d21 | ||
|
|
61a8ab5199 | ||
|
|
ce721c2e09 | ||
|
|
2862e3a6ee | ||
|
|
75c4a24cbd | ||
|
|
1cf7d791cc |
No files matched your search
Executable → Regular
+2
@@ -25,3 +25,5 @@ HMCL/build/
|
||||
HMCLServer/
|
||||
HMCSM/build/
|
||||
MetroLookAndFeel/build/
|
||||
/HMCUtils/build/
|
||||
/HMCLaF/build/
|
||||
+10
-1
@@ -14,6 +14,15 @@
|
||||
<task-args/>
|
||||
<task-jvm-args/>
|
||||
</task>
|
||||
<task>
|
||||
<display-name>createApp</display-name>
|
||||
<non-blocking>no</non-blocking>
|
||||
<task-names>
|
||||
<name must-exist="yes">createApp</name>
|
||||
</task-names>
|
||||
<task-args/>
|
||||
<task-jvm-args/>
|
||||
</task>
|
||||
</common-tasks>
|
||||
<script-platform>
|
||||
<spec-name>j2se</spec-name>
|
||||
@@ -22,6 +31,6 @@
|
||||
<license-header>
|
||||
<name>GNU General Public License</name>
|
||||
<template>license-header.txt</template>
|
||||
<property name="organization">huangyuhui</property>
|
||||
<property name="organization">HMCLSoft</property>
|
||||
</license-header>
|
||||
</gradle-project-properties>
|
||||
+5
-3
@@ -11,15 +11,15 @@ before_deploy:
|
||||
- git push -q ${REPO} --tags
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: lfFEwKtij/s9Ao/SKL7oVdsWcfASshZuwT27gllMrTx1ZQqLCG2I5mGJOp5ukx7lb3y4Tu316nFasLjy9NI3eLXSx9f0w4q+wMf0K5Yj9iOwu/TIn7JkLyHDMQ20qRwGxZplS2WUb669gIRg+l6jUHeTBW+dlTxr0mMa6WHIl8UDpHwfFrGC3i6dL4y6WlDwGl2rYktvOoA/iqvtglBcHuXaL2sDfhp5MXRcYULTIw+b9zmiQXP665DQN+Su5I3gwB4y5X8RH72GAacZn13fEIo5i8UUoHM7UQxM8y8DKSO3avyFCfpUle9+9sErQVW7b6JV1c+AoLWuAhNJLMlUTKarZE7UMqfjvoQHxX5hp2B2WHLEON/UJiGf25HJWx6VhJitE0/odujqnG/umesqki2jMTs6gPcxbc9iBjzUg+ZmFztdtC+Emnni7lpqVVl+Y5hsJRn3Z6rIiNgwmaE0r2OQgAm1vRYFc7jvOdRfyFG+uCRZF6nS56BzJ7dLc0WW8dTgSft6YFll4ZYL6hiI9qiIaBAK948y5HV+6VBWuO3xf/G2CUFbE1Y9qUCjToh3ahxNDzZvXB+rXqvlvNQOi5l8n594oQ61n45qIHSKlMBn9Bxhw29oWT5mo1aYIaNXbpzKam2w4mK0T3VrgTszu/3282wRbNr+VAwdGMfwW1s=
|
||||
api_key: ${DEPLOY_REPO}
|
||||
file:
|
||||
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
|
||||
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
|
||||
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}-MacOSApp.zip
|
||||
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
|
||||
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
|
||||
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}-MacOSApp.zip
|
||||
on:
|
||||
repo: huanghongxun/HMCL
|
||||
tags: false
|
||||
skip_cleanup: true
|
||||
install: echo "skip 'gradle assemble' step"
|
||||
@@ -30,3 +30,5 @@ cache:
|
||||
directories:
|
||||
- "$HOME/.gradle/caches/"
|
||||
- "$HOME/.gradle/wrapper/"
|
||||
git:
|
||||
depth: 1
|
||||
+109
-47
@@ -15,46 +15,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||
*/
|
||||
import java.util.jar.JarOutputStream
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
apply plugin: 'launch4j'
|
||||
apply plugin: 'me.tatarka.retrolambda'
|
||||
|
||||
if (!hasProperty('mainClass')) {
|
||||
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main'
|
||||
}
|
||||
|
||||
def buildnumber = System.getenv("TRAVIS_BUILD_NUMBER")
|
||||
if (buildnumber == null)
|
||||
buildnumber = System.getenv("BUILD_NUMBER")
|
||||
if (buildnumber == null)
|
||||
buildnumber = "233"
|
||||
|
||||
def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "2.4.1"
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
String bundleName = "Hello Minecraft! Launcher"
|
||||
|
||||
group = mavenGroupId
|
||||
version = mavenVersion
|
||||
|
||||
String mavenArtifactId = name
|
||||
|
||||
task generateSources(type: Copy) {
|
||||
from 'src/main/java'
|
||||
into "$buildDir/generated-src"
|
||||
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
|
||||
'HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING': mavenVersion
|
||||
])
|
||||
}
|
||||
compileJava.setSource "$buildDir/generated-src"
|
||||
compileJava.dependsOn generateSources
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral();
|
||||
@@ -71,6 +31,109 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "edu.sc.seis.macAppBundle" version "2.1.6"
|
||||
}
|
||||
|
||||
import java.util.jar.JarOutputStream
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
apply plugin: 'launch4j'
|
||||
apply plugin: 'me.tatarka.retrolambda'
|
||||
|
||||
if (!hasProperty('mainClass')) {
|
||||
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main'
|
||||
}
|
||||
|
||||
def readBuildNumber() {
|
||||
def versionPropsFile = file('version.properties')
|
||||
|
||||
if (versionPropsFile.canRead()) {
|
||||
def Properties versionProps = new Properties()
|
||||
versionProps.load(new FileInputStream(versionPropsFile))
|
||||
|
||||
def code = versionProps['VERSION_CODE'].toInteger() + 1
|
||||
versionProps['VERSION_CODE'] = code.toString()
|
||||
versionProps.store(versionPropsFile.newWriter(), null)
|
||||
|
||||
return code.toString()
|
||||
}
|
||||
return "233"
|
||||
}
|
||||
|
||||
def buildnumber = System.getenv("TRAVIS_BUILD_NUMBER")
|
||||
if (buildnumber == null)
|
||||
buildnumber = System.getenv("BUILD_NUMBER")
|
||||
if (buildnumber == null)
|
||||
buildnumber = readBuildNumber()
|
||||
|
||||
def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "2.5.0"
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
String bundleName = "Hello Minecraft! Launcher"
|
||||
|
||||
group = mavenGroupId
|
||||
version = mavenVersion
|
||||
|
||||
String mavenArtifactId = name
|
||||
|
||||
task generateSources(type: Copy) {
|
||||
from 'src/main/java'
|
||||
from 'src/core/java'
|
||||
into "$buildDir/generated-src"
|
||||
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
|
||||
'HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING': mavenVersion
|
||||
])
|
||||
}
|
||||
compileJava.setSource "$buildDir/generated-src"
|
||||
compileJava.dependsOn generateSources
|
||||
|
||||
task macAppCompressed(type: Zip, dependsOn: createApp) {
|
||||
archiveName "HMCL-$mavenVersion-MacOSApp.zip"
|
||||
include '**'
|
||||
destinationDir file("$buildDir/libs/")
|
||||
from "$buildDir/macApp"
|
||||
}
|
||||
|
||||
macAppBundle {
|
||||
mainClassName = mainClass
|
||||
icon = "src/main/icon.icns"
|
||||
javaProperties.put("apple.laf.useScreenMenuBar", "true")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = [
|
||||
'src/core/java/',
|
||||
'src/main/java/'
|
||||
]
|
||||
}
|
||||
resources {
|
||||
srcDirs = ['src/main/resources/']
|
||||
}
|
||||
}
|
||||
core {
|
||||
java {
|
||||
compileClasspath += main.compileClasspath
|
||||
runtimeClasspath += main.runtimeClasspath
|
||||
srcDirs 'src/core/java/'
|
||||
}
|
||||
resources {
|
||||
srcDirs 'src/main/resources/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
coreCompile.extendsFrom compile
|
||||
coreRuntime.extendsFrom runtime
|
||||
}
|
||||
|
||||
configure(install.repositories.mavenInstaller) {
|
||||
pom.project {
|
||||
groupId = mavenGroupId
|
||||
@@ -80,8 +143,8 @@ configure(install.repositories.mavenInstaller) {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(":MetroLookAndFeel")
|
||||
compile project(":HMCLAPI")
|
||||
compile project(":HMCLaF")
|
||||
compile project(":HMCUtils")
|
||||
compile group: "org.commonjava.googlecode.markdown4j", name: "markdown4j", version: "2.2-cj-1.0"
|
||||
}
|
||||
|
||||
@@ -93,22 +156,20 @@ jar {
|
||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
|
||||
manifest {
|
||||
attributes 'Created-By' : 'Copyright(c) 2013-2016 huangyuhui.',
|
||||
attributes 'Created-By' : 'Copyright(c) 2013-2016 HMCLSoft.',
|
||||
'Main-Class' : mainClass
|
||||
}
|
||||
}
|
||||
|
||||
launch4j {
|
||||
launch4jCmd = 'D:\\Develop\\Java\\Launch4j\\launch4j.exe'
|
||||
//launch4jCmd = '/home/huangyuhui/softwares/launch4j/launch4j'
|
||||
supportUrl = 'http://www.mcbbs.net/thread-142335-1-1.html'
|
||||
supportUrl = 'http://www.hmclsoft.com'
|
||||
jreMinVersion = '1.6.0'
|
||||
|
||||
mainClassName = mainClass
|
||||
icon = new File(project.buildDir, '../icon.ico').absolutePath
|
||||
version = mavenVersion
|
||||
downloadUrl = 'http://java.com/download'
|
||||
copyright = "Copyright(c) 2013-2015 huangyuhui."
|
||||
copyright = "Copyright(c) 2013-2015 HMCLSoft."
|
||||
|
||||
jar = new File(project.buildDir, 'libs/' + mavenGroupId + '-' + mavenVersion + '.jar').absolutePath
|
||||
outfile = mavenGroupId + '-' + mavenVersion + '.exe'
|
||||
@@ -123,3 +184,4 @@ processResources {
|
||||
|
||||
build.dependsOn makeExecutable
|
||||
build.dependsOn makePackGZ
|
||||
build.dependsOn macAppCompressed
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+2
-3
@@ -19,7 +19,6 @@ package org.jackhuang.hellominecraft.launcher.api;
|
||||
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Profile;
|
||||
import org.jackhuang.hellominecraft.launcher.core.auth.AuthenticationException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
|
||||
import org.jackhuang.hellominecraft.launcher.core.auth.UserProfileProvider;
|
||||
@@ -35,12 +34,12 @@ public interface IPlugin {
|
||||
/**
|
||||
* You can modify the application actions by this method.
|
||||
*
|
||||
* @param profile info to the Minecraft Loader
|
||||
* @param obj minecraft service wanted
|
||||
*
|
||||
* @return For example, you can implement IMinecraftProvider to support
|
||||
* MultiMC
|
||||
*/
|
||||
IMinecraftService provideMinecraftService(Profile profile);
|
||||
IMinecraftService provideMinecraftService(Object obj);
|
||||
|
||||
/**
|
||||
* Register authenticators by calling IAuthenticator.LOGINS.add.
|
||||
+10
-7
@@ -18,7 +18,6 @@
|
||||
package org.jackhuang.hellominecraft.launcher.api;
|
||||
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.launcher.util.DefaultPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,17 +25,21 @@ import org.jackhuang.hellominecraft.launcher.util.DefaultPlugin;
|
||||
*/
|
||||
public class PluginManager {
|
||||
|
||||
private static IPlugin NOW_PLUGIN = new DefaultPlugin();
|
||||
private static IPlugin NOW_PLUGIN;
|
||||
|
||||
public static void getServerPlugin() {
|
||||
try {
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
Class c = cl.loadClass("org.jackhuang.hellominecraft.launcher.server.ServerPlugin");
|
||||
IPlugin p = (IPlugin) c.newInstance();
|
||||
NOW_PLUGIN = p;
|
||||
getPlugin(Thread.currentThread().getContextClassLoader().loadClass("org.jackhuang.hellominecraft.launcher.server.ServerPlugin"));
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void getPlugin(Class<?> cls) {
|
||||
try {
|
||||
IPlugin p = (IPlugin) cls.newInstance();
|
||||
NOW_PLUGIN = p;
|
||||
} catch (Exception e) {
|
||||
HMCLog.err("Failed to new instance");
|
||||
HMCLog.err("Failed to new instance");
|
||||
}
|
||||
}
|
||||
|
||||
File renamed without changes.
File renamed without changes.
+5
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.asset;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -29,7 +30,11 @@ import java.util.Set;
|
||||
public class AssetsIndex {
|
||||
|
||||
public static final String DEFAULT_ASSET_NAME = "legacy";
|
||||
|
||||
@SerializedName("objects")
|
||||
public Map<String, AssetsObject> objects;
|
||||
|
||||
@SerializedName("virtual")
|
||||
public boolean virtual;
|
||||
|
||||
public AssetsIndex() {
|
||||
+1
-1
@@ -98,7 +98,7 @@ public class AssetsMojangLoader extends IAssetsHandler {
|
||||
|
||||
@Override
|
||||
public Task getDownloadTask(IDownloadProvider sourceType) {
|
||||
return new AssetsTask(sourceType.getAssetsDownloadURL());
|
||||
return new AssetsTask(sourceType.getAssetsDownloadURL(), sourceType.getRetryAssetsDownloadURL());
|
||||
}
|
||||
|
||||
@Override
|
||||
File renamed without changes.
File renamed without changes.
+37
-12
@@ -34,6 +34,8 @@ import org.jackhuang.hellominecraft.util.code.DigestUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.NetUtils;
|
||||
import org.jackhuang.hellominecraft.util.OverridableSwingWorker;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
import org.jackhuang.hellominecraft.util.tasks.TaskInfo;
|
||||
|
||||
/**
|
||||
@@ -89,30 +91,37 @@ public abstract class IAssetsHandler {
|
||||
|
||||
protected class AssetsTask extends TaskInfo {
|
||||
|
||||
ArrayList<Task> al;
|
||||
String u;
|
||||
ArrayList<Task> tasks;
|
||||
String baseUrl;
|
||||
String retryBaseUrl;
|
||||
|
||||
public AssetsTask(String url) {
|
||||
public AssetsTask(String url, String retryUrl) {
|
||||
super(C.i18n("assets.download"));
|
||||
this.u = url;
|
||||
this.baseUrl = url;
|
||||
this.retryBaseUrl = retryUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask() {
|
||||
if (assetsDownloadURLs == null || assetsLocalNames == null || contents == null)
|
||||
throw new IllegalStateException(C.i18n("assets.not_refreshed"));
|
||||
|
||||
tasks = new ArrayList<>();
|
||||
int max = assetsDownloadURLs.size();
|
||||
al = new ArrayList<>();
|
||||
int hasDownloaded = 0;
|
||||
for (int i = 0; i < max; i++) {
|
||||
String mark = assetsDownloadURLs.get(i);
|
||||
String url = u + mark;
|
||||
String downloadUrl = baseUrl + mark;
|
||||
String downloadRetryUrl = StrUtils.isNotBlank(retryBaseUrl) ? retryBaseUrl + mark : "";
|
||||
File location = assetsLocalNames.get(i);
|
||||
|
||||
if (!location.getParentFile().exists() && !location.getParentFile().mkdirs())
|
||||
HMCLog.warn("Failed to make directories: " + location.getParent());
|
||||
|
||||
if (location.isDirectory())
|
||||
continue;
|
||||
boolean need = true;
|
||||
|
||||
boolean needDownload = true;
|
||||
try {
|
||||
if (location.exists()) {
|
||||
FileInputStream fis = new FileInputStream(location);
|
||||
@@ -121,23 +130,39 @@ public abstract class IAssetsHandler {
|
||||
if (contents.get(i).geteTag().equals(sha)) {
|
||||
++hasDownloaded;
|
||||
HMCLog.log("File " + assetsLocalNames.get(i) + " has been downloaded successfully, skipped downloading.");
|
||||
if (ppl != null)
|
||||
if (ppl != null) {
|
||||
ppl.setProgress(this, hasDownloaded, max);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
HMCLog.warn("Failed to get hash: " + location, e);
|
||||
need = !location.exists();
|
||||
needDownload = !location.exists();
|
||||
}
|
||||
if (need)
|
||||
al.add(new FileDownloadTask(url, location).setTag(mark));
|
||||
|
||||
if (needDownload) {
|
||||
FileDownloadTask fileDownloadTask = new FileDownloadTask(downloadUrl, location);
|
||||
fileDownloadTask.setTag(mark);
|
||||
|
||||
// retry
|
||||
if (StrUtils.isNotBlank(downloadRetryUrl)) {
|
||||
fileDownloadTask.setFailedCallbackReturnsNewURL(new Function<Integer, String>() {
|
||||
@Override
|
||||
public String apply(Integer t) {
|
||||
return downloadRetryUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tasks.add(fileDownloadTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Task> getAfterTasks() {
|
||||
return al;
|
||||
return tasks;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -56,7 +56,8 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
public Task downloadAssets(final MinecraftVersion mv) {
|
||||
if (mv == null)
|
||||
return null;
|
||||
return IAssetsHandler.ASSETS_HANDLER.getList(mv, service.asset()).after(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(service.getDownloadType().getProvider()));
|
||||
return IAssetsHandler.ASSETS_HANDLER.getList(mv, service.asset())
|
||||
.after(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(service.getDownloadType().getProvider()));
|
||||
}
|
||||
|
||||
@Override
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+12
-2
@@ -17,14 +17,24 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.auth.yggdrasil;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class Response {
|
||||
|
||||
public String accessToken, clientToken;
|
||||
@SerializedName("accessToken")
|
||||
public String accessToken;
|
||||
@SerializedName("clientToken")
|
||||
public String clientToken;
|
||||
@SerializedName("selectedProfile")
|
||||
public GameProfile selectedProfile;
|
||||
@SerializedName("availableProfiles")
|
||||
public GameProfile[] availableProfiles;
|
||||
@SerializedName("user")
|
||||
public User user;
|
||||
|
||||
@SerializedName("error")
|
||||
public String error;
|
||||
@SerializedName("errorMessage")
|
||||
public String errorMessage;
|
||||
@SerializedName("cause")
|
||||
public String cause;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -148,7 +148,7 @@ public class YggdrasilAuthentication {
|
||||
|
||||
if (StrUtils.isNotBlank(response.error)) {
|
||||
HMCLog.err("Failed to log in, the auth server returned an error: " + response.error + ", message: " + response.errorMessage + ", cause: " + response.cause);
|
||||
if (response.errorMessage.contains("Invalid token"))
|
||||
if (response.errorMessage != null && response.errorMessage.contains("Invalid token"))
|
||||
response.errorMessage = C.i18n("login.invalid_token");
|
||||
throw new AuthenticationException("Request error: " + response.errorMessage);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+3
-1
@@ -29,10 +29,12 @@ public class DownloadLibraryJob {
|
||||
|
||||
public IMinecraftLibrary lib;
|
||||
public String url;
|
||||
public String retryUrl;
|
||||
public File path;
|
||||
|
||||
public DownloadLibraryJob(IMinecraftLibrary n, String u, File p) {
|
||||
public DownloadLibraryJob(IMinecraftLibrary n, String u, String retry, File p) {
|
||||
url = u;
|
||||
retryUrl = retry;
|
||||
lib = n;
|
||||
path = IOUtils.tryGetCanonicalFile(p);
|
||||
}
|
||||
+3
-2
@@ -29,7 +29,8 @@ public enum DownloadType {
|
||||
Mojang("download.mojang", new MojangDownloadProvider()),
|
||||
BMCL("download.BMCL", new BMCLAPIDownloadProvider()),
|
||||
//RapidData("download.rapid_data", new RapidDataDownloadProvider()),
|
||||
Curse("Curse CDN", new CurseDownloadProvider());
|
||||
Curse("Curse CDN", new CurseDownloadProvider()),
|
||||
Dynamic("HMCLSoft", DynamicDownloadProvider.getInstance());
|
||||
|
||||
private final String name;
|
||||
private final IDownloadProvider provider;
|
||||
@@ -47,7 +48,7 @@ public enum DownloadType {
|
||||
return C.i18n(name);
|
||||
}
|
||||
|
||||
private static DownloadType suggestedDownloadType = Mojang;
|
||||
private static DownloadType suggestedDownloadType = Dynamic;
|
||||
|
||||
public static DownloadType getSuggestedDownloadType() {
|
||||
return suggestedDownloadType;
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* 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.launcher.core.download;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.NetUtils;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author evilwk <evilwk@gmail.com>
|
||||
*/
|
||||
public class DynamicDownloadProvider extends MojangDownloadProvider {
|
||||
|
||||
private static final String PROVIDER_ADDR = "http://client.api.mcgogogo.com:81/provider.php";
|
||||
|
||||
private volatile static DynamicDownloadProvider instance;
|
||||
|
||||
private String versionManifestAddr = null;
|
||||
private String launcherMetaAddr = null;
|
||||
private String launcherAddr = null;
|
||||
|
||||
private String librariesAddr = null;
|
||||
private String assetsAddr = null;
|
||||
|
||||
public void setVersionManifestAddr(String versionManifestAddr) {
|
||||
this.versionManifestAddr = versionManifestAddr;
|
||||
}
|
||||
|
||||
public void setLauncherMetaAddr(String launcherMetaAddr) {
|
||||
this.launcherMetaAddr = launcherMetaAddr;
|
||||
}
|
||||
|
||||
public void setLauncherAddr(String launcherAddr) {
|
||||
this.launcherAddr = launcherAddr;
|
||||
}
|
||||
|
||||
public void setLibrariesAddr(String librariesAddr) {
|
||||
this.librariesAddr = librariesAddr;
|
||||
}
|
||||
|
||||
public void setAssetsAddr(String assetsAddr) {
|
||||
this.assetsAddr = assetsAddr;
|
||||
}
|
||||
|
||||
private DynamicDownloadProvider() {
|
||||
|
||||
}
|
||||
|
||||
public static DynamicDownloadProvider getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (DynamicDownloadProvider.class) {
|
||||
if (instance == null) {
|
||||
instance = new DynamicDownloadProvider();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRetryAssetsDownloadURL() {
|
||||
return super.getAssetsDownloadURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRetryLibraryDownloadURL() {
|
||||
return super.getLibraryDownloadURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAssetsDownloadURL() {
|
||||
if (StrUtils.isNotBlank(assetsAddr)) {
|
||||
return assetsAddr;
|
||||
}
|
||||
return super.getAssetsDownloadURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLibraryDownloadURL() {
|
||||
if (StrUtils.isNotBlank(librariesAddr)) {
|
||||
return librariesAddr;
|
||||
}
|
||||
return super.getLibraryDownloadURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersionsListDownloadURL() {
|
||||
if (StrUtils.isNotBlank(versionManifestAddr)) {
|
||||
return versionManifestAddr;
|
||||
}
|
||||
return super.getVersionsListDownloadURL();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParsedDownloadURL(String str) {
|
||||
if (StrUtils.isNotBlank(librariesAddr)) {
|
||||
str = str.replace("https://libraries.minecraft.net", librariesAddr);
|
||||
}
|
||||
if (StrUtils.isNotBlank(launcherMetaAddr)) {
|
||||
str = str.replace("https://launchermeta.mojang.com", launcherMetaAddr);
|
||||
}
|
||||
if (StrUtils.isNotBlank(launcherMetaAddr)) {
|
||||
str = str.replace("https://launcher.mojang.com", launcherAddr);
|
||||
}
|
||||
return super.getParsedDownloadURL(str);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
new Thread() {
|
||||
|
||||
private String getValue(Map<String, String> addrInfo, String key) {
|
||||
String value = null;
|
||||
do {
|
||||
if (!addrInfo.containsKey(key))
|
||||
continue;
|
||||
value = addrInfo.get(key);
|
||||
} while(false);
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String providerInfo = NetUtils.get(PROVIDER_ADDR);
|
||||
Map<String, String> addrInfo = null;
|
||||
addrInfo = C.GSON.fromJson(providerInfo, new TypeToken<Map<String, String>>() {
|
||||
}.getType());
|
||||
if (addrInfo != null) {
|
||||
setLibrariesAddr(getValue(addrInfo, "libraries"));
|
||||
setAssetsAddr(getValue(addrInfo, "assets"));
|
||||
setLauncherMetaAddr(getValue(addrInfo, "launcherMeta"));
|
||||
setLauncherAddr(getValue(addrInfo, "launcher"));
|
||||
setVersionManifestAddr(getValue(addrInfo, "versionManifest"));
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -38,7 +38,7 @@ public abstract class IDownloadProvider {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public abstract InstallerVersionList getForgeInstaller();
|
||||
|
||||
public abstract InstallerVersionList getLiteLoaderInstaller();
|
||||
@@ -46,6 +46,10 @@ public abstract class IDownloadProvider {
|
||||
public abstract InstallerVersionList getOptiFineInstaller();
|
||||
|
||||
public abstract String getLibraryDownloadURL();
|
||||
|
||||
public String getRetryLibraryDownloadURL() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public abstract String getVersionsDownloadURL();
|
||||
|
||||
@@ -55,6 +59,10 @@ public abstract class IDownloadProvider {
|
||||
|
||||
public abstract String getAssetsDownloadURL();
|
||||
|
||||
public String getRetryAssetsDownloadURL() {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* For example, minecraft.json/assetIndex/url or
|
||||
* minecraft.json/downloads/client/url
|
||||
+16
-9
@@ -31,6 +31,7 @@ import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.GameDownloadInfo;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.IMinecraftLibrary;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.LibraryDownloadInfo;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
@@ -53,14 +54,17 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
||||
ArrayList<DownloadLibraryJob> downloadLibraries = new ArrayList<>();
|
||||
if (mv == null)
|
||||
return downloadLibraries;
|
||||
|
||||
MinecraftVersion v = mv.resolve(service.version());
|
||||
for (IMinecraftLibrary l : v.getLibraries())
|
||||
if (l != null && l.allow() && l.getDownloadInfo() != null) {
|
||||
File ff = l.getFilePath(service.baseDirectory());
|
||||
for (IMinecraftLibrary libraryInfo : v.getLibraries())
|
||||
if (libraryInfo != null && libraryInfo.allow() && libraryInfo.getDownloadInfo() != null) {
|
||||
File ff = libraryInfo.getFilePath(service.baseDirectory());
|
||||
if (!ff.exists()) {
|
||||
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
|
||||
if (libURL != null)
|
||||
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
|
||||
LibraryDownloadInfo downloadInfo = libraryInfo.getDownloadInfo();
|
||||
String downloadUrl = downloadInfo.getUrl(service.getDownloadType());
|
||||
String retryDownloadUrl = downloadInfo.getRetryUrl(service.getDownloadType());
|
||||
if (downloadUrl != null)
|
||||
downloadLibraries.add(new DownloadLibraryJob(libraryInfo, downloadUrl, retryDownloadUrl, ff));
|
||||
}
|
||||
}
|
||||
return downloadLibraries;
|
||||
@@ -114,10 +118,13 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apply(Integer t) {
|
||||
return DownloadType.values()[t / 2].getProvider().getVersionsDownloadURL() + suffix;
|
||||
public String apply(Integer repeat) {
|
||||
int index = repeat / 2;
|
||||
if (index > DownloadType.values().length) {
|
||||
index = 0;
|
||||
}
|
||||
return DownloadType.values()[index].getProvider().getVersionsDownloadURL() + suffix;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
File renamed without changes.
File renamed without changes.
+3
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.download;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.ArrayList;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.NetUtils;
|
||||
@@ -28,7 +29,9 @@ import org.jackhuang.hellominecraft.util.OverridableSwingWorker;
|
||||
*/
|
||||
public class MinecraftRemoteVersions {
|
||||
|
||||
@SerializedName("versions")
|
||||
public ArrayList<MinecraftRemoteVersion> versions;
|
||||
@SerializedName("latest")
|
||||
public MinecraftRemoteLatestVersion latest;
|
||||
|
||||
private static volatile MinecraftRemoteVersions INSTANCE = null;
|
||||
+9
-4
@@ -41,27 +41,32 @@ public class MojangDownloadProvider extends IDownloadProvider {
|
||||
public InstallerVersionList getOptiFineInstaller() {
|
||||
return org.jackhuang.hellominecraft.launcher.core.install.optifine.vanilla.OptiFineVersionList.getInstance();
|
||||
}
|
||||
|
||||
|
||||
// jars
|
||||
@Override
|
||||
public String getLibraryDownloadURL() {
|
||||
return "https://libraries.minecraft.net";
|
||||
}
|
||||
|
||||
// jars
|
||||
@Override
|
||||
public String getVersionsDownloadURL() {
|
||||
return "http://s3.amazonaws.com/Minecraft.Download/versions/";
|
||||
}
|
||||
|
||||
|
||||
// resource
|
||||
@Override
|
||||
public String getIndexesDownloadURL() {
|
||||
return "http://s3.amazonaws.com/Minecraft.Download/indexes/";
|
||||
}
|
||||
|
||||
|
||||
// game versions json
|
||||
@Override
|
||||
public String getVersionsListDownloadURL() {
|
||||
return "https://launchermeta.mojang.com/mc/game/version_manifest.json";
|
||||
}
|
||||
|
||||
|
||||
// resource
|
||||
@Override
|
||||
public String getAssetsDownloadURL() {
|
||||
return "https://resources.download.minecraft.net/";
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Executable
+139
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* 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.launcher.core.install;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public abstract class InstallerVersionList {
|
||||
|
||||
/**
|
||||
* Refresh installer versions list from the downloaded content.
|
||||
*
|
||||
* @param versions Minecraft versions you need to refresh
|
||||
*
|
||||
* @throws java.lang.Exception including network exceptions, IO exceptions.
|
||||
*/
|
||||
public abstract Task refresh(String[] versions);
|
||||
|
||||
/**
|
||||
* Installer name.
|
||||
*
|
||||
* @return installer name.
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Get installers you want.
|
||||
*
|
||||
* @param mcVersion the installers to this Minecraft version.
|
||||
*
|
||||
* @return cached result.
|
||||
*/
|
||||
protected abstract List<InstallerVersion> getVersionsImpl(String mcVersion);
|
||||
|
||||
/**
|
||||
* Get installers you want, please cache this method's result to save time.
|
||||
*
|
||||
* @param mcVersion the installers to this Minecraft version.
|
||||
*
|
||||
* @return a copy of the cached data to prevent
|
||||
* ConcurrentModificationException.
|
||||
*/
|
||||
public List<InstallerVersion> getVersions(String mcVersion) {
|
||||
List<InstallerVersion> a = getVersionsImpl(mcVersion);
|
||||
if (a == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new ArrayList<>(a);
|
||||
}
|
||||
}
|
||||
|
||||
public static int compareVersion(String verOne, String verTwo) {
|
||||
String[] verInfoOne = verOne.split("\\.");
|
||||
String[] verInfoTwo = verTwo.split("\\.");
|
||||
int idx = 0;
|
||||
int minLength = Math.min(verInfoOne.length, verInfoTwo.length);
|
||||
int diff = 0;
|
||||
while (idx < minLength
|
||||
&& (diff = verInfoOne[idx].length() - verInfoTwo[idx].length()) == 0
|
||||
&& (diff = verInfoOne[idx].compareTo(verInfoTwo[idx])) == 0) {
|
||||
++idx;
|
||||
}
|
||||
diff = (diff != 0) ? diff : verInfoOne.length - verInfoTwo.length;
|
||||
return (diff == 0) ? 0 : (diff < 0 ? -1 : 1);
|
||||
}
|
||||
|
||||
public static class InstallerVersion implements Comparable<InstallerVersion> {
|
||||
|
||||
public String selfVersion, mcVersion;
|
||||
public String installer, universal;
|
||||
public String changelog;
|
||||
|
||||
public InstallerVersion(String selfVersion, String mcVersion) {
|
||||
this.selfVersion = selfVersion;
|
||||
this.mcVersion = mcVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(InstallerVersion o) {
|
||||
return compareVersion(selfVersion, o.selfVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return selfVersion.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final InstallerVersion other = (InstallerVersion) obj;
|
||||
return Objects.equals(this.selfVersion, other.selfVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class InstallerVersionComparator implements Comparator<InstallerVersion>, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3276198781795213723L;
|
||||
|
||||
public static final InstallerVersionComparator INSTANCE = new InstallerVersionComparator();
|
||||
|
||||
@Override
|
||||
public int compare(InstallerVersion o1, InstallerVersion o2) {
|
||||
return o2.compareTo(o1);
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-5
@@ -18,7 +18,6 @@
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.forge;
|
||||
|
||||
import org.jackhuang.hellominecraft.launcher.core.install.InstallProfile;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
@@ -32,6 +31,7 @@ import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.util.NetUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftLibrary;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -79,10 +79,8 @@ public class ForgeInstaller extends Task {
|
||||
File file = new File(gameDir, "libraries/" + forge.getDownloadInfo().path);
|
||||
if (file.getParentFile().mkdirs())
|
||||
HMCLog.warn("Failed to make library directory " + file.getParent());
|
||||
try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos)) {
|
||||
int c;
|
||||
while ((c = is.read()) != -1)
|
||||
bos.write((byte) c);
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
IOUtils.copyStream(is, fos);
|
||||
}
|
||||
mp.version().refreshVersions();
|
||||
}
|
||||
File renamed without changes.
+11
@@ -17,20 +17,31 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.forge;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class Install {
|
||||
|
||||
@SerializedName("profileName")
|
||||
private String profileName;
|
||||
@SerializedName("target")
|
||||
private String target;
|
||||
@SerializedName("path")
|
||||
private String path;
|
||||
@SerializedName("version")
|
||||
private String version;
|
||||
@SerializedName("filePath")
|
||||
private String filePath;
|
||||
@SerializedName("welcome")
|
||||
private String welcome;
|
||||
@SerializedName("minecraft")
|
||||
private String minecraft;
|
||||
@SerializedName("mirrorList")
|
||||
private String mirrorList;
|
||||
@SerializedName("logo")
|
||||
private String logo;
|
||||
|
||||
public Install() {
|
||||
File renamed without changes.
+5
-2
@@ -76,10 +76,13 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
||||
|
||||
for (Map.Entry<String, int[]> arr : root.mcversion.entrySet()) {
|
||||
String mcver = StrUtils.formatVersion(arr.getKey());
|
||||
if (mcver == null) {
|
||||
mcver = arr.getKey();
|
||||
}
|
||||
ArrayList<InstallerVersion> al = new ArrayList<>();
|
||||
for (int num : arr.getValue()) {
|
||||
MinecraftForgeVersion v = root.number.get(num);
|
||||
InstallerVersion iv = new InstallerVersion(v.version, StrUtils.formatVersion(v.mcversion));
|
||||
InstallerVersion iv = new InstallerVersion(v.version, v.mcversion);
|
||||
for (String[] f : v.files) {
|
||||
|
||||
String ver = v.mcversion + "-" + v.version;
|
||||
@@ -108,7 +111,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
||||
versions.add(iv);
|
||||
}
|
||||
|
||||
versionMap.put(StrUtils.formatVersion(mcver), al);
|
||||
versionMap.put(mcver, al);
|
||||
}
|
||||
|
||||
Collections.sort(versions, new InstallerVersionComparator());
|
||||
+17
-2
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.forge;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -25,8 +26,22 @@ import java.util.Map;
|
||||
*/
|
||||
public class MinecraftForgeVersionRoot {
|
||||
|
||||
public String artifact, webpath, adfly, homepage, name;
|
||||
public Map<String, int[]> branches, mcversion;
|
||||
@SerializedName("artifact")
|
||||
public String artifact;
|
||||
@SerializedName("webpath")
|
||||
public String webpath;
|
||||
@SerializedName("adfly")
|
||||
public String adfly;
|
||||
@SerializedName("homepage")
|
||||
public String homepage;
|
||||
@SerializedName("name")
|
||||
public String name;
|
||||
@SerializedName("branches")
|
||||
public Map<String, int[]> branches;
|
||||
@SerializedName("mcversion")
|
||||
public Map<String, int[]> mcversion;
|
||||
@SerializedName("promos")
|
||||
public Map<String, Integer> promos;
|
||||
@SerializedName("number")
|
||||
public Map<Integer, MinecraftForgeVersion> number;
|
||||
}
|
||||
File renamed without changes.
+2
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.liteloader;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -25,5 +26,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class LiteLoaderMCVersions {
|
||||
|
||||
@SerializedName("artefacts")
|
||||
public Map<String, Map<String, LiteLoaderVersion>> artefacts;
|
||||
}
|
||||
+12
-1
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.liteloader;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftLibrary;
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,16 @@ import org.jackhuang.hellominecraft.launcher.core.version.MinecraftLibrary;
|
||||
*/
|
||||
public class LiteLoaderVersion {
|
||||
|
||||
public String tweakClass, file, version, md5, timestamp;
|
||||
@SerializedName("tweakClass")
|
||||
public String tweakClass;
|
||||
@SerializedName("file")
|
||||
public String file;
|
||||
@SerializedName("version")
|
||||
public String version;
|
||||
@SerializedName("md5")
|
||||
public String md5;
|
||||
@SerializedName("timestamp")
|
||||
public String timestamp;
|
||||
@SerializedName("libraries")
|
||||
public MinecraftLibrary[] libraries;
|
||||
}
|
||||
File renamed without changes.
+8
-1
@@ -17,13 +17,20 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.liteloader;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class LiteLoaderVersionsMeta {
|
||||
|
||||
private String description, authors, url;
|
||||
@SerializedName("versions")
|
||||
private String description;
|
||||
@SerializedName("authors")
|
||||
private String authors;
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
|
||||
public LiteLoaderVersionsMeta() {
|
||||
}
|
||||
+3
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.install.liteloader;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class LiteLoaderVersionsRoot {
|
||||
|
||||
@SerializedName("versions")
|
||||
public Map<String, LiteLoaderMCVersions> versions;
|
||||
@SerializedName("meta")
|
||||
public LiteLoaderVersionsMeta meta;
|
||||
}
|
||||
+2
-1
@@ -72,7 +72,8 @@ public class OptiFineInstaller extends Task implements PreviousResultRegistrar<F
|
||||
mv.mainClass = "net.minecraft.launchwrapper.Launch";
|
||||
mv.libraries.add(1, new MinecraftLibrary("net.minecraft:launchwrapper:1.7"));
|
||||
}
|
||||
mv.minecraftArguments += " --tweakClass optifine.OptiFineTweaker";
|
||||
if (!mv.minecraftArguments.contains("FMLTweaker"))
|
||||
mv.minecraftArguments += " --tweakClass optifine.OptiFineTweaker";
|
||||
}
|
||||
}
|
||||
File loc = new File(service.baseDirectory(), "versions/" + mv.id);
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+3
-2
@@ -120,7 +120,7 @@ public class GameLauncher {
|
||||
*
|
||||
* @throws IOException failed creating process
|
||||
*/
|
||||
public void launch(List str) throws IOException {
|
||||
public void launch(List<String> str) throws IOException {
|
||||
if (!service.version().onLaunch(options.getLaunchVersion()))
|
||||
return;
|
||||
if (StrUtils.isNotBlank(options.getPrecalledCommand())) {
|
||||
@@ -133,6 +133,7 @@ public class GameLauncher {
|
||||
}
|
||||
}
|
||||
HMCLog.log("Starting process");
|
||||
HMCLog.log(str.toString());
|
||||
ProcessBuilder builder = new ProcessBuilder(str);
|
||||
if (options.getLaunchVersion() == null || service.baseDirectory() == null)
|
||||
throw new Error("Fucking bug!");
|
||||
@@ -174,7 +175,7 @@ public class GameLauncher {
|
||||
if (appdata != null) {
|
||||
writer.write("set appdata=" + appdata);
|
||||
writer.newLine();
|
||||
writer.write("cd %appdata%");
|
||||
writer.write("cd /D %appdata%");
|
||||
writer.newLine();
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+12
-2
@@ -21,6 +21,8 @@ import java.io.File;
|
||||
import java.net.URL;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadLibraryJob;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
|
||||
|
||||
/**
|
||||
@@ -49,12 +51,20 @@ public class LibraryDownloadTask extends FileDownloadTask {
|
||||
if (s.length == 3 && s[2].length() > 3)
|
||||
job.url = "http://dl.liteloader.com/versions/com/mumfrey/liteloader/" + s[2].substring(0, s[2].length() - 3) + "/liteloader-" + s[2] + ".jar";
|
||||
}
|
||||
download(new URL(job.url), job.path);
|
||||
download(new URL(job.url), job.retryUrl, job.path);
|
||||
}
|
||||
|
||||
void download(URL url, File filePath) throws Throwable {
|
||||
void download(URL url, String retryUrl, File filePath) throws Throwable {
|
||||
this.url = url;
|
||||
this.filePath = filePath;
|
||||
if (StrUtils.isNotBlank(retryUrl)) {
|
||||
this.failedCallbackReturnsNewURL = new Function<Integer, String>() {
|
||||
@Override
|
||||
public String apply(Integer t) {
|
||||
return retryUrl;
|
||||
}
|
||||
};
|
||||
}
|
||||
super.executeTask();
|
||||
}
|
||||
|
||||
+20
-2
@@ -19,6 +19,7 @@ package org.jackhuang.hellominecraft.launcher.core.launch;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
@@ -44,9 +45,24 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
@Override
|
||||
protected void makeSelf(List<String> res) throws GameException {
|
||||
StringBuilder library = new StringBuilder("");
|
||||
ArrayList<MinecraftLibrary> opt = new ArrayList<>();
|
||||
for (MinecraftLibrary l : version.libraries)
|
||||
if (l.allow() && !l.isRequiredToUnzip())
|
||||
library.append(l.getFilePath(gameDir).getAbsolutePath()).append(File.pathSeparator);
|
||||
if (l.allow() && !l.isRequiredToUnzip()) {
|
||||
if (l.name.toLowerCase().contains("optifine")) {
|
||||
opt.add(l);
|
||||
continue;
|
||||
}
|
||||
File f = l.getFilePath(gameDir);
|
||||
if (f == null)
|
||||
continue;
|
||||
library.append(f.getAbsolutePath()).append(File.pathSeparator);
|
||||
}
|
||||
for (MinecraftLibrary l : opt) {
|
||||
File f = l.getFilePath(gameDir);
|
||||
if (f == null)
|
||||
continue;
|
||||
library.append(f.getAbsolutePath()).append(File.pathSeparator);
|
||||
}
|
||||
File f = version.getJar(service.baseDirectory());
|
||||
if (!f.exists())
|
||||
throw new GameException("Minecraft jar does not exists");
|
||||
@@ -55,6 +71,8 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
res.add(library.toString().substring(0, library.length() - File.pathSeparator.length()));
|
||||
res.add(version.mainClass);
|
||||
|
||||
if (version.minecraftArguments == null)
|
||||
throw new GameException(new NullPointerException("Minecraft Arguments can not be null."));
|
||||
String[] splitted = StrUtils.tokenize(version.minecraftArguments);
|
||||
|
||||
String game_assets = assetProvider.apply(version, !options.isNotCheckGame());
|
||||
File renamed without changes.
+51
-13
@@ -17,12 +17,15 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.mod;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -37,9 +40,30 @@ import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
*/
|
||||
public class ModInfo implements Comparable<ModInfo> {
|
||||
|
||||
@SerializedName("location")
|
||||
public File location;
|
||||
public String modid, name, description, author, version, mcversion, url, updateUrl, credits;
|
||||
@SerializedName("modid")
|
||||
public String modid;
|
||||
@SerializedName("name")
|
||||
public String name;
|
||||
@SerializedName("description")
|
||||
public String description;
|
||||
@SerializedName("author")
|
||||
public String author;
|
||||
@SerializedName("version")
|
||||
public String version;
|
||||
@SerializedName("mcversion")
|
||||
public String mcversion;
|
||||
@SerializedName("url")
|
||||
public String url;
|
||||
@SerializedName("updateUrl")
|
||||
public String updateUrl;
|
||||
@SerializedName("credits")
|
||||
public String credits;
|
||||
@SerializedName("authorList")
|
||||
public String[] authorList;
|
||||
@SerializedName("authors")
|
||||
public String[] authors;
|
||||
|
||||
public boolean isActive() {
|
||||
return !location.getName().endsWith(".disabled");
|
||||
@@ -67,6 +91,8 @@ public class ModInfo implements Comparable<ModInfo> {
|
||||
public String getAuthor() {
|
||||
if (authorList != null && authorList.length > 0)
|
||||
return StrUtils.parseParams("", authorList, ", ");
|
||||
else if (authors != null && authors.length > 0)
|
||||
return StrUtils.parseParams("", authors, ", ");
|
||||
else if (StrUtils.isNotBlank(author))
|
||||
return author;
|
||||
else
|
||||
@@ -103,18 +129,30 @@ public class ModInfo implements Comparable<ModInfo> {
|
||||
return name.endsWith(".zip") || name.endsWith(".jar") || name.endsWith("litemod");
|
||||
}
|
||||
|
||||
private static final Type TYPE = new TypeToken<List<ModInfo>>() {
|
||||
}.getType();
|
||||
|
||||
private static ModInfo getForgeModInfo(File f, ZipFile jar, ZipEntry entry) throws IOException {
|
||||
ModInfo i = new ModInfo();
|
||||
i.location = f;
|
||||
List<ModInfo> m = C.GSON.fromJson(new InputStreamReader(jar.getInputStream(entry), "UTF-8"), TYPE);
|
||||
if (m != null && m.size() > 0) {
|
||||
i = m.get(0);
|
||||
i.location = f;
|
||||
}
|
||||
return i;
|
||||
ModInfo i = new ModInfo();
|
||||
i.location = f;
|
||||
|
||||
InputStreamReader streamReader = new InputStreamReader(jar.getInputStream(entry), "UTF-8");
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonElement element = parser.parse(streamReader);
|
||||
List<ModInfo> m = null;
|
||||
if (element.isJsonArray()) {
|
||||
m = C.GSON.fromJson(element, new TypeToken<List<ModInfo>>(){}.getType());
|
||||
} else if (element.isJsonObject()) {
|
||||
JsonObject modInfo = element.getAsJsonObject();
|
||||
if (modInfo.has("modList") && modInfo.get("modList").isJsonArray()) {
|
||||
m = C.GSON.fromJson(modInfo.get("modList"), new TypeToken<List<ModInfo>>(){}.getType());
|
||||
}
|
||||
}
|
||||
|
||||
if (m != null && m.size() > 0) {
|
||||
i = m.get(0);
|
||||
i.location = f;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
private static ModInfo getLiteLoaderModInfo(File f, ZipFile jar, ZipEntry entry) throws IOException {
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
@@ -27,6 +28,7 @@ import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
*/
|
||||
public class Extract implements Cloneable {
|
||||
|
||||
@SerializedName("exclude")
|
||||
public List<String> exclude = new ArrayList<>();
|
||||
|
||||
public boolean allow(String path) {
|
||||
File renamed without changes.
+4
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
|
||||
|
||||
/**
|
||||
@@ -25,8 +26,11 @@ import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
|
||||
*/
|
||||
public class GameDownloadInfo implements Cloneable {
|
||||
|
||||
@SerializedName("sha1")
|
||||
public String sha1;
|
||||
@SerializedName("size")
|
||||
public int size;
|
||||
@SerializedName("url")
|
||||
protected String url;
|
||||
|
||||
/**
|
||||
File renamed without changes.
+3
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,8 @@ import java.util.Map;
|
||||
*/
|
||||
public class LibrariesDownloadInfo {
|
||||
|
||||
@SerializedName("classifiers")
|
||||
Map<String, LibraryDownloadInfo> classifiers;
|
||||
@SerializedName("artifact")
|
||||
LibraryDownloadInfo artifact;
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.IDownloadProvider;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class LibraryDownloadInfo extends GameDownloadInfo {
|
||||
|
||||
@SerializedName("path")
|
||||
public String path;
|
||||
@SerializedName("forgeURL")
|
||||
public String forgeURL;
|
||||
|
||||
@Override
|
||||
public String getUrl(DownloadType dt, boolean allowSelf) {
|
||||
IDownloadProvider provider = dt.getProvider();
|
||||
String downloadUrl = (forgeURL == null ? provider.getLibraryDownloadURL() : forgeURL);
|
||||
if (StrUtils.isNotBlank(url) && allowSelf) {
|
||||
downloadUrl = url;
|
||||
} // forced replace: Let different download sources into force
|
||||
return provider.getParsedDownloadURL(getUrlWithBaseUrl(downloadUrl));
|
||||
}
|
||||
|
||||
public String getRetryUrl(DownloadType dt) {
|
||||
IDownloadProvider provider = dt.getProvider();
|
||||
String retryBaseUrl = provider.getRetryLibraryDownloadURL();
|
||||
|
||||
String downloadUrl = (forgeURL == null ? retryBaseUrl : forgeURL);
|
||||
if (StrUtils.isNotBlank(url) && provider.isAllowedToUseSelfURL()) {
|
||||
downloadUrl = url;
|
||||
}
|
||||
|
||||
if (StrUtils.isBlank(downloadUrl)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
downloadUrl = getUrlWithBaseUrl(downloadUrl);
|
||||
if (downloadUrl.contains("minecraftforge")) { // fix forge url
|
||||
downloadUrl = provider.getParsedDownloadURL(downloadUrl);
|
||||
}
|
||||
|
||||
return downloadUrl;
|
||||
}
|
||||
|
||||
private String getUrlWithBaseUrl(String baseUrl) {
|
||||
if (!baseUrl.endsWith(".jar")) {
|
||||
if (path == null) {
|
||||
return null;
|
||||
} else {
|
||||
baseUrl = IOUtils.addURLSeparator(baseUrl) + path.replace('\\', '/');
|
||||
}
|
||||
}
|
||||
return baseUrl;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+43
-24
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -30,10 +31,15 @@ import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
*/
|
||||
public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
|
||||
@SerializedName("rules")
|
||||
public ArrayList<Rules> rules;
|
||||
@SerializedName("url")
|
||||
public String url;
|
||||
@SerializedName("natives")
|
||||
public Natives natives;
|
||||
@SerializedName("extract")
|
||||
public Extract extract;
|
||||
@SerializedName("downloads")
|
||||
public LibrariesDownloadInfo downloads;
|
||||
|
||||
public MinecraftLibrary(String name) {
|
||||
@@ -42,29 +48,25 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
|
||||
public MinecraftLibrary(ArrayList<Rules> rules, String url, Natives natives, String name, Extract extract, LibraryDownloadInfo downloads) {
|
||||
super(name);
|
||||
this.rules = rules == null ? null : (ArrayList<Rules>) rules.clone();
|
||||
this.rules = (rules == null) ? null : (ArrayList<Rules>) rules.clone();
|
||||
this.url = url;
|
||||
this.natives = natives == null ? null : (Natives) natives.clone();
|
||||
this.extract = extract == null ? null : (Extract) extract.clone();
|
||||
this.natives = (natives == null) ? null : (Natives) natives.clone();
|
||||
this.extract = (extract == null) ? null : (Extract) extract.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* is the library allowed to load.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean allow() {
|
||||
if (rules != null) {
|
||||
boolean flag = false;
|
||||
for (Rules r : rules)
|
||||
for (Rules r : rules) {
|
||||
if ("disallow".equals(r.action()))
|
||||
return false;
|
||||
else if ("allow".equals(r.action()))
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String formatArch(String nati) {
|
||||
@@ -89,17 +91,25 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
|
||||
public String formatName() {
|
||||
String[] s = name.split(":");
|
||||
if (s.length < 3)
|
||||
if (s.length < 3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder(s[0].replace('.', '/')).append('/').append(s[1]).append('/').append(s[2]).append('/').append(s[1]).append('-').append(s[2]);
|
||||
if (natives != null)
|
||||
if (natives != null) {
|
||||
sb.append('-').append(getNative());
|
||||
}
|
||||
|
||||
return sb.append(".jar").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getFilePath(File gameDir) {
|
||||
return new File(gameDir, "libraries/" + getDownloadInfo().path);
|
||||
LibraryDownloadInfo info = getDownloadInfo();
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
return new File(gameDir, "libraries/" + info.path);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,25 +118,34 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
}
|
||||
|
||||
public LibraryDownloadInfo getDownloadInfo() {
|
||||
if (downloads == null)
|
||||
if (downloads == null) {
|
||||
downloads = new LibrariesDownloadInfo();
|
||||
LibraryDownloadInfo info;
|
||||
}
|
||||
|
||||
LibraryDownloadInfo info = null;
|
||||
if (natives != null) {
|
||||
if (downloads.classifiers == null)
|
||||
if (downloads.classifiers == null) {
|
||||
downloads.classifiers = new HashMap<>();
|
||||
if (!downloads.classifiers.containsKey(getNative()))
|
||||
downloads.classifiers.put(getNative(), info = new LibraryDownloadInfo());
|
||||
else
|
||||
info = downloads.classifiers.get(getNative());
|
||||
} else if (downloads.artifact == null)
|
||||
} else {
|
||||
if (!downloads.classifiers.containsKey(getNative())) {
|
||||
downloads.classifiers.put(getNative(), info = new LibraryDownloadInfo());
|
||||
} else {
|
||||
info = downloads.classifiers.get(getNative());
|
||||
}
|
||||
}
|
||||
} else if (downloads.artifact == null) {
|
||||
downloads.artifact = info = new LibraryDownloadInfo();
|
||||
else
|
||||
} else {
|
||||
info = downloads.artifact;
|
||||
}
|
||||
|
||||
if (StrUtils.isBlank(info.path)) {
|
||||
info.path = formatName();
|
||||
if (info.path == null)
|
||||
if (info.path == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
info.forgeURL = this.url;
|
||||
return info;
|
||||
}
|
||||
File renamed without changes.
+27
-3
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -37,14 +38,37 @@ import org.jackhuang.hellominecraft.util.Utils;
|
||||
*/
|
||||
public class MinecraftVersion implements Cloneable, Comparable<MinecraftVersion> {
|
||||
|
||||
public String minecraftArguments, mainClass, time, id, type, processArguments,
|
||||
releaseTime, jar, inheritsFrom, runDir;
|
||||
@SerializedName("minecraftArguments")
|
||||
public String minecraftArguments;
|
||||
@SerializedName("mainClass")
|
||||
public String mainClass;
|
||||
@SerializedName("time")
|
||||
public String time;
|
||||
@SerializedName("id")
|
||||
public String id;
|
||||
@SerializedName("type")
|
||||
public String type;
|
||||
@SerializedName("processArguments")
|
||||
public String processArguments;
|
||||
@SerializedName("releaseTime")
|
||||
public String releaseTime;
|
||||
@SerializedName("jar")
|
||||
public String jar;
|
||||
@SerializedName("inheritsFrom")
|
||||
public String inheritsFrom;
|
||||
@SerializedName("runDir")
|
||||
public String runDir;
|
||||
@SerializedName("assets")
|
||||
protected String assets;
|
||||
@SerializedName("minimumLauncherVersion")
|
||||
public int minimumLauncherVersion;
|
||||
@SerializedName("hidden")
|
||||
public boolean hidden;
|
||||
@SerializedName("assetIndex")
|
||||
public AssetIndexDownloadInfo assetIndex;
|
||||
@SerializedName("downloads")
|
||||
private Map<String, GameDownloadInfo> downloads;
|
||||
|
||||
@SerializedName("libraries")
|
||||
public ArrayList<MinecraftLibrary> libraries;
|
||||
|
||||
public MinecraftVersion() {
|
||||
File renamed without changes.
+8
-1
@@ -17,13 +17,20 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.core.version;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public class Natives implements Cloneable {
|
||||
|
||||
public String windows, osx, linux;
|
||||
@SerializedName("windows")
|
||||
public String windows;
|
||||
@SerializedName("osx")
|
||||
public String osx;
|
||||
@SerializedName("linux")
|
||||
public String linux;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("CloneDeclaresCloneNotSupported")
|
||||
Loaded 100 of 326 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user