Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e5cc3dadb | ||
|
|
f6d5dd5a82 | ||
|
|
cafcf458b8 | ||
|
|
e7d0624b96 | ||
|
|
156de2457d | ||
|
|
c839d045cc | ||
|
|
2eaf32b23d | ||
|
|
5899c73ab8 | ||
|
|
6c0a446692 | ||
|
|
7c2cfc171e | ||
|
|
5d4a3c1df6 | ||
|
|
587df1f5bb | ||
|
|
019fcf314b | ||
|
|
1818b3575c | ||
|
|
afde41135a | ||
|
|
5dc812072f | ||
|
|
3ba75d2de3 |
No files matched your search
+5
-3
@@ -7,15 +7,17 @@ branches:
|
||||
before_deploy:
|
||||
- git config --global user.email ${GITHUB_EMAIL}
|
||||
- git config --global user.name ${GITHUB_NAME}
|
||||
- git tag ${VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}
|
||||
- git tag ${TRAVIS_BUILD_NUMBER}
|
||||
- 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=
|
||||
file:
|
||||
- HMCL/build/libs/HMCL-${VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
|
||||
- HMCL/build/libs/HMCL-${VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
|
||||
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
|
||||
- HMCL/build/libs/HMCL-${HMCL_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
|
||||
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.jar
|
||||
- HMCSM/build/libs/HMCSM-${HMCSM_VERSION_ROOT}.${TRAVIS_BUILD_NUMBER}.exe
|
||||
on:
|
||||
repo: huanghongxun/HMCL
|
||||
tags: false
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ if (buildnumber == null)
|
||||
|
||||
def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "2.4.0"
|
||||
versionroot = "2.4.1"
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/home/huangyuhui/softwares/jdk1.8.0_65/jre/bin/java -XX:+UseG1GC -XX:-UseAdaptiveSizePolicy -XX:-OmitStackTraceInFastThrow -Xmn128m -Xmx3968m -Djava.library.path=/home/huangyuhui/game/testempty/versions/1.9-pre3/1.9-pre3-natives -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true -Duser.home=/home/huangyuhui/game -cp /home/huangyuhui/NetBeansProjects/HMCL/HMCL/build/classes/main/:/home/huangyuhui/NetBeansProjects/HMCL/HMCL/build/resources/main/:/home/huangyuhui/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.2.4/a60a5e993c98c864010053cb901b7eab25306568/gson-2.2.4.jar:/home/huangyuhui/NetBeansProjects/HMCL/MetroLookAndFeel/build/libs/MetroLookAndFeel.jar:/home/huangyuhui/NetBeansProjects/HMCL/HMCLAPI/build/libs/HMCLAPI.jar:/home/huangyuhui/.gradle/caches/modules-2/files-2.1/org.commonjava.googlecode.markdown4j/markdown4j/2.2-cj-1.0/ba35b052c48261a17e94ae5c31e8e9ad9b9f4d2c/markdown4j-2.2-cj-1.0.jar org.jackhuang.hellominecraft.launcher.Launcher -cp=/home/huangyuhui/game/testempty/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar:/home/huangyuhui/game/testempty/libraries/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar:/home/huangyuhui/game/testempty/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar:/home/huangyuhui/game/testempty/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:/home/huangyuhui/game/testempty/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:/home/huangyuhui/game/testempty/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar:/home/huangyuhui/game/testempty/libraries/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar:/home/huangyuhui/game/testempty/libraries/com/google/guava/guava/17.0/guava-17.0.jar:/home/huangyuhui/game/testempty/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar:/home/huangyuhui/game/testempty/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar:/home/huangyuhui/game/testempty/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:/home/huangyuhui/game/testempty/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:/home/huangyuhui/game/testempty/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:/home/huangyuhui/game/testempty/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar:/home/huangyuhui/game/testempty/libraries/com/mojang/authlib/1.5.22/authlib-1.5.22.jar:/home/huangyuhui/game/testempty/libraries/com/mojang/realms/1.8.1/realms-1.8.1.jar:/home/huangyuhui/game/testempty/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar:/home/huangyuhui/game/testempty/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar:/home/huangyuhui/game/testempty/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:/home/huangyuhui/game/testempty/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar:/home/huangyuhui/game/testempty/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar:/home/huangyuhui/game/testempty/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar:/home/huangyuhui/game/testempty/libraries/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar:/home/huangyuhui/game/testempty/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar:/home/huangyuhui/game/testempty/versions/1.9-pre3/1.9-pre3.jar -mainClass=net.minecraft.client.main.Main --username huangyuhui --version "HMCL 2.4.0.233" --gameDir /home/huangyuhui/game/testempty --assetsDir /home/huangyuhui/game/testempty/assets --assetIndex 1.9 --uuid c14d042145c04aff8ecbcf85ebbc4400 --accessToken 6fc6bdb6854c4692a5edcd3da4444fb0 --userType mojang --versionType "HMCL 2.4.0.233" --height 480 --width 854
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.util.MinecraftCrashAdvicer;
|
||||
import org.jackhuang.hellominecraft.util.DoubleOutputStream;
|
||||
import org.jackhuang.hellominecraft.util.LauncherPrintStream;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
public final class Launcher {
|
||||
|
||||
static final Logger LOGGER = Logger.getLogger(Launcher.class.getName());
|
||||
|
||||
static String classPath = "";
|
||||
|
||||
public static void main(String[] args) {
|
||||
LOGGER.log(Level.INFO, "*** {0} ***", Main.makeTitle());
|
||||
|
||||
boolean showInfo = false;
|
||||
String mainClass = "net.minecraft.client.Minecraft";
|
||||
|
||||
ArrayList<String> cmdList = new ArrayList<>();
|
||||
|
||||
for (String s : args)
|
||||
if (s.startsWith("-cp="))
|
||||
classPath = classPath.concat(s.substring("-cp=".length()));
|
||||
else if (s.startsWith("-mainClass="))
|
||||
mainClass = s.substring("-mainClass=".length());
|
||||
else if (s.equals("-debug"))
|
||||
showInfo = true;
|
||||
else
|
||||
cmdList.add(s);
|
||||
|
||||
String[] tokenized = StrUtils.tokenize(classPath, File.pathSeparator);
|
||||
int len = tokenized.length;
|
||||
|
||||
if (showInfo) {
|
||||
try {
|
||||
File logFile = new File("hmclmc.log");
|
||||
if (!logFile.exists() && !logFile.createNewFile())
|
||||
LOGGER.info("Failed to create log file");
|
||||
else {
|
||||
FileOutputStream tc = new FileOutputStream(logFile);
|
||||
DoubleOutputStream out = new DoubleOutputStream(tc, System.out);
|
||||
System.setOut(new LauncherPrintStream(out));
|
||||
DoubleOutputStream err = new DoubleOutputStream(tc, System.err);
|
||||
System.setErr(new LauncherPrintStream(err));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.log(Level.SEVERE, "Failed to add log file appender.", e);
|
||||
}
|
||||
|
||||
LOGGER.log(Level.INFO, "Arguments: '{'\n{0}\n'}'", StrUtils.parseParams(" ", args, "\n"));
|
||||
LOGGER.log(Level.INFO, "Main Class: {0}", mainClass);
|
||||
LOGGER.log(Level.INFO, "Class Path: '{'\n{0}\n'}'", StrUtils.parseParams(" ", tokenized, "\n"));
|
||||
}
|
||||
|
||||
URL[] urls = new URL[len];
|
||||
|
||||
try {
|
||||
for (int j = 0; j < len; j++)
|
||||
urls[j] = new File(tokenized[j]).toURI().toURL();
|
||||
} catch (Throwable e) {
|
||||
LOGGER.log(Level.SEVERE, "Failed to get classpath.", e);
|
||||
return;
|
||||
}
|
||||
|
||||
Method minecraftMain;
|
||||
URLClassLoader ucl = new URLClassLoader(urls, URLClassLoader.getSystemClassLoader().getParent());
|
||||
Thread.currentThread().setContextClassLoader(ucl);
|
||||
try {
|
||||
minecraftMain = ucl.loadClass(mainClass).getMethod("main", String[].class);
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException t) {
|
||||
LOGGER.log(Level.SEVERE, "Minecraft main class not found.", t);
|
||||
return;
|
||||
}
|
||||
|
||||
LOGGER.info("*** Launching Game ***");
|
||||
|
||||
int flag = 0;
|
||||
try {
|
||||
minecraftMain.invoke(null, new Object[] { (String[]) cmdList.toArray(new String[cmdList.size()]) });
|
||||
} catch (Throwable throwable) {
|
||||
String trace = StrUtils.getStackTrace(throwable);
|
||||
System.err.println(C.i18n("crash.minecraft"));
|
||||
System.err.println(MinecraftCrashAdvicer.getAdvice(trace));
|
||||
System.err.println(trace);
|
||||
flag = 1;
|
||||
}
|
||||
|
||||
LOGGER.info("*** Game Exited ***");
|
||||
|
||||
try {
|
||||
Utils.shutdownForcely(flag);
|
||||
} catch (Exception e) {
|
||||
LOGGER.log(Level.SEVERE, "Failed to shut down this process...", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
-14
@@ -19,6 +19,8 @@ package org.jackhuang.hellominecraft.launcher.core.asset;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
@@ -30,8 +32,9 @@ import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.IDownloadProvider;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.util.OverridableSwingWorker;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
import org.jackhuang.hellominecraft.util.VersionNumber;
|
||||
import org.jackhuang.hellominecraft.util.tasks.TaskInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -44,19 +47,25 @@ public class AssetsMojangLoader extends IAssetsHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public OverridableSwingWorker<String[]> getList(final MinecraftVersion mv, final IMinecraftAssetService mp) {
|
||||
return new OverridableSwingWorker<String[]>() {
|
||||
public Task getList(final MinecraftVersion mv, final IMinecraftAssetService mp) {
|
||||
Utils.requireNonNull(mv);
|
||||
String assetsId = mv.getAssetsIndex().getId();
|
||||
File assets = mp.getAssets();
|
||||
HMCLog.log("Gathering asset index: " + assetsId);
|
||||
File f = IOUtils.tryGetCanonicalFile(new File(assets, "indexes/" + assetsId + ".json"));
|
||||
return new TaskInfo("Gather asset index") {
|
||||
@Override
|
||||
protected void work() throws Exception {
|
||||
if (mv == null)
|
||||
throw new IllegalArgumentException("AssetsMojangLoader: null argument: MinecraftVersion");
|
||||
String assetsId = mv.getAssetsIndex().getId();
|
||||
File assets = mp.getAssets();
|
||||
HMCLog.log("Gathering asset index: " + assetsId);
|
||||
File f = IOUtils.tryGetCanonicalFile(new File(assets, "indexes/" + assetsId + ".json"));
|
||||
if (!f.exists() && !mp.downloadMinecraftAssetsIndex(mv.getAssetsIndex()))
|
||||
throw new IllegalStateException("Failed to get index json");
|
||||
public Collection<Task> getDependTasks() {
|
||||
if (!f.exists())
|
||||
return Arrays.asList(mp.downloadMinecraftAssetsIndex(mv.getAssetsIndex()));
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask() throws Throwable {
|
||||
if (!areDependTasksSucceeded)
|
||||
throw new IllegalStateException("Failed to get asset index");
|
||||
String result = FileUtils.readFileToString(f);
|
||||
if (StrUtils.isBlank(result))
|
||||
throw new IllegalStateException("Index json is empty, please redownload it!");
|
||||
@@ -66,6 +75,7 @@ public class AssetsMojangLoader extends IAssetsHandler {
|
||||
ArrayList<String> al = new ArrayList<>();
|
||||
contents = new ArrayList<>();
|
||||
HashSet<String> loadedHashes = new HashSet<>();
|
||||
int pgs = 0;
|
||||
if (o != null && o.getFileMap() != null)
|
||||
for (Map.Entry<String, AssetsObject> e : o.getFileMap().entrySet()) {
|
||||
if (loadedHashes.contains(e.getValue().getHash()))
|
||||
@@ -79,9 +89,9 @@ public class AssetsMojangLoader extends IAssetsHandler {
|
||||
assetsDownloadURLs.add(c.key);
|
||||
assetsLocalNames.add(new File(assets, "objects" + File.separator + c.key.replace("/", File.separator)));
|
||||
al.add(e.getKey());
|
||||
if (ppl != null)
|
||||
ppl.setProgress(this, ++pgs, o.getFileMap().size());
|
||||
}
|
||||
|
||||
publish(al.toArray(new String[1]));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public abstract class IAssetsHandler {
|
||||
* @param mp Asset Service
|
||||
* @param x finished event
|
||||
*/
|
||||
public abstract OverridableSwingWorker<String[]> getList(MinecraftVersion mv, IMinecraftAssetService mp);
|
||||
public abstract Task getList(MinecraftVersion mv, IMinecraftAssetService mp);
|
||||
|
||||
/**
|
||||
* Will be invoked when the user invoked "Download all assets".
|
||||
|
||||
+43
-7
@@ -20,6 +20,7 @@ package org.jackhuang.hellominecraft.launcher.core.asset;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -29,6 +30,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.AssetIndexDownloadInfo;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
import org.jackhuang.hellominecraft.util.func.Function;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
@@ -54,19 +56,23 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
}
|
||||
|
||||
public Task downloadAssets(final MinecraftVersion mv) {
|
||||
if (mv == null)
|
||||
return null;
|
||||
return new TaskInfo("Download Assets") {
|
||||
Collection<Task> afters = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void executeTask() throws Throwable {
|
||||
IAssetsHandler type = IAssetsHandler.ASSETS_HANDLER;
|
||||
type.getList(mv, service.asset()).justDo();
|
||||
afters.add(type.getDownloadTask(service.getDownloadType().getProvider()));
|
||||
public Collection<Task> getDependTasks() {
|
||||
return Arrays.asList(IAssetsHandler.ASSETS_HANDLER.getList(mv, service.asset()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Task> getAfterTasks() {
|
||||
return afters;
|
||||
return Arrays.asList(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(service.getDownloadType().getProvider()));
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -76,11 +82,41 @@ public class MinecraftAssetService extends IMinecraftAssetService {
|
||||
MinecraftVersion mv = service.version().getVersionById(id);
|
||||
if (mv == null)
|
||||
return false;
|
||||
return downloadMinecraftAssetsIndex(mv.getAssetsIndex());
|
||||
return downloadMinecraftAssetsIndexAsync(mv.getAssetsIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean downloadMinecraftAssetsIndex(AssetIndexDownloadInfo assets) {
|
||||
public Task downloadMinecraftAssetsIndex(AssetIndexDownloadInfo assets) {
|
||||
File assetsLocation = getAssets();
|
||||
if (!assetsLocation.exists() && !assetsLocation.mkdirs())
|
||||
HMCLog.warn("Failed to make directories: " + assetsLocation);
|
||||
File assetsIndex = new File(assetsLocation, "indexes/" + assets.getId() + ".json");
|
||||
File renamed = null;
|
||||
if (assetsIndex.exists()) {
|
||||
renamed = new File(assetsLocation, "indexes/" + assets.getId() + "-renamed.json");
|
||||
if (assetsIndex.renameTo(renamed))
|
||||
HMCLog.warn("Failed to rename " + assetsIndex + " to " + renamed);
|
||||
}
|
||||
File renamedFinal = renamed;
|
||||
return new TaskInfo("Download Asset Index") {
|
||||
@Override
|
||||
public Collection<Task> getDependTasks() {
|
||||
return Arrays.asList(new FileDownloadTask(assets.getUrl(service.getDownloadType()), IOUtils.tryGetCanonicalFile(assetsIndex), assets.sha1).setTag(assets.getId() + ".json"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask() throws Throwable {
|
||||
if (areDependTasksSucceeded) {
|
||||
if (renamedFinal != null && !renamedFinal.delete())
|
||||
HMCLog.warn("Failed to delete " + renamedFinal + ", maybe you should do it.");
|
||||
} else if (renamedFinal != null && !renamedFinal.renameTo(assetsIndex))
|
||||
HMCLog.warn("Failed to rename " + renamedFinal + " to " + assetsIndex);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean downloadMinecraftAssetsIndexAsync(AssetIndexDownloadInfo assets) {
|
||||
File assetsLocation = getAssets();
|
||||
if (!assetsLocation.exists() && !assetsLocation.mkdirs())
|
||||
HMCLog.warn("Failed to make directories: " + assetsLocation);
|
||||
|
||||
+8
-4
@@ -57,7 +57,7 @@ public class BMCLAPIDownloadProvider extends IDownloadProvider {
|
||||
|
||||
@Override
|
||||
public String getVersionsListDownloadURL() {
|
||||
return "http://bmclapi2.bangbang93.com/versions/versions.json";
|
||||
return "http://bmclapi2.bangbang93.com/mc/game/version_manifest.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,13 +66,17 @@ public class BMCLAPIDownloadProvider extends IDownloadProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParsedLibraryDownloadURL(String str) {
|
||||
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://bmclapi2.bangbang93.com/maven");
|
||||
public String getParsedDownloadURL(String str) {
|
||||
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
|
||||
public boolean isAllowedToUseSelfURL() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -24,7 +24,7 @@ package org.jackhuang.hellominecraft.launcher.core.download;
|
||||
public class CurseDownloadProvider extends MojangDownloadProvider {
|
||||
|
||||
@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/");
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -55,7 +55,15 @@ public abstract class IDownloadProvider {
|
||||
|
||||
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();
|
||||
}
|
||||
+61
-112
@@ -21,6 +21,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftDownloadServ
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
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.IMinecraftLibrary;
|
||||
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.func.Function;
|
||||
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.TaskInfo;
|
||||
|
||||
@@ -55,74 +54,46 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
||||
if (mv == null)
|
||||
return downloadLibraries;
|
||||
MinecraftVersion v = mv.resolve(service.version());
|
||||
if (v.libraries != null)
|
||||
for (IMinecraftLibrary l : v.libraries)
|
||||
if (l.allow()) {
|
||||
File ff = l.getFilePath(service.baseDirectory());
|
||||
if (!ff.exists()) {
|
||||
String libURL = service.getDownloadType().getProvider().getParsedLibraryDownloadURL(l.getDownloadInfo().getUrl(service.getDownloadType()));
|
||||
if (libURL != null)
|
||||
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
|
||||
}
|
||||
for (IMinecraftLibrary l : v.getLibraries())
|
||||
if (l != null && l.allow() && l.getDownloadInfo() != null) {
|
||||
File ff = l.getFilePath(service.baseDirectory());
|
||||
if (!ff.exists()) {
|
||||
String libURL = l.getDownloadInfo().getUrl(service.getDownloadType());
|
||||
if (libURL != null)
|
||||
downloadLibraries.add(new DownloadLibraryJob(l, libURL, ff));
|
||||
}
|
||||
}
|
||||
return downloadLibraries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task downloadMinecraft(String id) {
|
||||
return new TaskInfo("Download Minecraft") {
|
||||
@Override
|
||||
public Collection<Task> getDependTasks() {
|
||||
return Arrays.asList(downloadMinecraftVersionJson(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
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 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");
|
||||
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())
|
||||
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");
|
||||
t.addTaskListener(new DoingDoneListener<Task>() {
|
||||
@Override
|
||||
public void onDone(Task k, Collection<Task> taskCollection) {
|
||||
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);
|
||||
afters.add(downloadMinecraftJar(mv, mvj));
|
||||
} catch (JsonSyntaxException ex) {
|
||||
HMCLog.err("Failed to parse minecraft version json.", ex);
|
||||
FileUtils.deleteDirectory(vpath);
|
||||
}
|
||||
}
|
||||
|
||||
Collection<Task> afters = new HashSet<>();
|
||||
@@ -134,34 +105,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> {
|
||||
|
||||
String suffix;
|
||||
@@ -178,37 +121,43 @@ public class MinecraftDownloadService extends IMinecraftDownloadService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Task downloadMinecraftJarTo(MinecraftVersion mv, File mvt) {
|
||||
String jar = mv.jar == null ? mv.id : mv.jar;
|
||||
public Task downloadMinecraftJar(MinecraftVersion mv, File mvj) {
|
||||
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
|
||||
public boolean downloadMinecraftVersionJson(String id) {
|
||||
String vurl = service.getDownloadType().getProvider().getVersionsDownloadURL() + id + "/";
|
||||
File vpath = new File(service.baseDirectory(), "versions/" + id);
|
||||
File mvv = new File(vpath, id + ".json"), moved = null;
|
||||
if (mvv.exists()) {
|
||||
moved = new File(vpath, id + "-renamed.json");
|
||||
if (!mvv.renameTo(moved))
|
||||
HMCLog.warn("Failed to rename " + mvv + " to " + moved);
|
||||
}
|
||||
File mvt = new File(vpath, id + ".json");
|
||||
if (!vpath.exists() && !vpath.mkdirs())
|
||||
HMCLog.warn("Failed to make version folder " + vpath);
|
||||
if (TaskWindow.factory()
|
||||
.append(new FileDownloadTask(vurl + id + ".json", mvt).setTag(id + ".json"))
|
||||
.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 minecraft version json" + mvt);
|
||||
if (moved != null && moved.exists() && !moved.renameTo(mvt))
|
||||
HMCLog.warn("Failed to rename " + moved + " to " + mvt);
|
||||
return false;
|
||||
}
|
||||
public Task downloadMinecraftVersionJson(String id) {
|
||||
return new TaskInfo("Download Minecraft Json") {
|
||||
@Override
|
||||
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 mvt = new File(vpath, id + ".json");
|
||||
if (!vpath.exists() && !vpath.mkdirs())
|
||||
HMCLog.warn("Failed to make directories: " + vpath);
|
||||
if (mvt.exists() && !mvt.delete())
|
||||
HMCLog.warn("Failed to delete " + mvt);
|
||||
|
||||
afters.add(new FileDownloadTask(jsonURL, mvt).setTag(id + ".json"));
|
||||
}
|
||||
|
||||
Collection<Task> afters = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public Collection<Task> getAfterTasks() {
|
||||
return afters;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -73,9 +73,11 @@ public class MojangDownloadProvider extends IDownloadProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParsedLibraryDownloadURL(String str) {
|
||||
public String getParsedDownloadURL(String str) {
|
||||
if (str == null)
|
||||
return null;
|
||||
else if (str.contains("scala-swing") || str.contains("scala-xml") || str.contains("scala-parser-combinators"))
|
||||
return str.replace("http://files.minecraftforge.net/maven", "http://ftb.cursecdn.com/FTB2/maven/");
|
||||
else if (str.contains("typesafe") || str.contains("scala"))
|
||||
if (SupportedLocales.NOW_LOCALE.self == Locale.CHINA)
|
||||
return str.replace("http://files.minecraftforge.net/maven", "http://maven.oschina.net/content/groups/public");
|
||||
@@ -84,5 +86,4 @@ public class MojangDownloadProvider extends IDownloadProvider {
|
||||
else
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class RapidDataDownloadProvider extends MojangDownloadProvider {
|
||||
}
|
||||
|
||||
@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");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public final class MinecraftInstallerService extends IMinecraftInstallerService
|
||||
File filepath = IOUtils.tryGetCanonicalFile(IOUtils.currentDirWithSeparator() + "forge-installer.jar");
|
||||
if (v.installer != null)
|
||||
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))
|
||||
.create();
|
||||
}
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
||||
public void refreshList(String[] needed) throws Exception {
|
||||
if (root != null)
|
||||
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);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
|
||||
if (!StrUtils.isBlank(v.branch))
|
||||
ver = ver + "-" + v.branch;
|
||||
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]) {
|
||||
case "installer":
|
||||
iv.installer = url;
|
||||
|
||||
+3
-10
@@ -30,7 +30,6 @@ import org.jackhuang.hellominecraft.util.system.OS;
|
||||
import org.jackhuang.hellominecraft.util.system.Platform;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
import org.jackhuang.hellominecraft.launcher.Launcher;
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.auth.UserProfileProvider;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
@@ -68,6 +67,9 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
|
||||
public void makeHeadCommand(List<String> res) {
|
||||
HMCLog.log("On making head command.");
|
||||
|
||||
if (StrUtils.isNotBlank(options.getWrapper()))
|
||||
res.add(options.getWrapper());
|
||||
|
||||
JdkVersion jv = options.getJava();
|
||||
res.add(options.getJavaDir());
|
||||
|
||||
@@ -127,12 +129,6 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
|
||||
|
||||
if (OS.os() != OS.WINDOWS)
|
||||
res.add("-Duser.home=" + gameDir.getParent());
|
||||
|
||||
if (!options.isCanceledWrapper()) {
|
||||
res.add("-cp");
|
||||
res.add(StrUtils.parseParams("", Utils.getURLString(), File.pathSeparator));
|
||||
res.add(Launcher.class.getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,9 +161,6 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
|
||||
if (options.isFullscreen())
|
||||
res.add("--fullscreen");
|
||||
|
||||
if (options.isDebug() && !options.isCanceledWrapper())
|
||||
res.add("-debug");
|
||||
|
||||
if (StrUtils.isNotBlank(options.getProxyHost()) && StrUtils.isNotBlank(options.getProxyPort()) && MathUtils.canParseInt(options.getProxyPort())) {
|
||||
res.add("--proxyHost");
|
||||
res.add(options.getProxyHost());
|
||||
|
||||
+10
-18
@@ -28,9 +28,9 @@ import org.jackhuang.hellominecraft.util.system.JdkVersion;
|
||||
*/
|
||||
public class LaunchOptions {
|
||||
|
||||
private String name, versionName, javaArgs, minecraftArgs, maxMemory, permSize, width, height, serverIp;
|
||||
private String name, versionName, javaArgs, minecraftArgs, maxMemory, permSize, width, height, serverIp, wrapper;
|
||||
private String proxyHost, proxyPort, proxyUser, proxyPass, javaDir, launchVersion, type, precalledCommand;
|
||||
private boolean fullscreen, debug, noJVMArgs, canceledWrapper;
|
||||
private boolean fullscreen, noJVMArgs;
|
||||
private JdkVersion java;
|
||||
private File gameDir;
|
||||
private GameDirType gameDirType;
|
||||
@@ -95,6 +95,14 @@ public class LaunchOptions {
|
||||
this.maxMemory = maxMemory;
|
||||
}
|
||||
|
||||
public String getWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public void setWrapper(String wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
}
|
||||
|
||||
public String getWidth() {
|
||||
return width;
|
||||
}
|
||||
@@ -119,14 +127,6 @@ public class LaunchOptions {
|
||||
this.fullscreen = fullscreen;
|
||||
}
|
||||
|
||||
public boolean isDebug() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
public void setDebug(boolean debug) {
|
||||
this.debug = debug;
|
||||
}
|
||||
|
||||
public GameDirType getGameDirType() {
|
||||
return gameDirType;
|
||||
}
|
||||
@@ -159,14 +159,6 @@ public class LaunchOptions {
|
||||
this.minecraftArgs = minecraftArgs;
|
||||
}
|
||||
|
||||
public boolean isCanceledWrapper() {
|
||||
return canceledWrapper;
|
||||
}
|
||||
|
||||
public void setCanceledWrapper(boolean canceledWrapper) {
|
||||
this.canceledWrapper = canceledWrapper;
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
|
||||
+3
-5
@@ -43,7 +43,7 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
|
||||
@Override
|
||||
protected void makeSelf(List<String> res) throws GameException {
|
||||
StringBuilder library = new StringBuilder(options.isCanceledWrapper() ? "" : "-cp=");
|
||||
StringBuilder library = new StringBuilder("");
|
||||
for (MinecraftLibrary l : version.libraries)
|
||||
if (l.allow() && !l.isRequiredToUnzip())
|
||||
library.append(l.getFilePath(gameDir).getAbsolutePath()).append(File.pathSeparator);
|
||||
@@ -51,11 +51,9 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
|
||||
if (!f.exists())
|
||||
throw new GameException("Minecraft jar does not exists");
|
||||
library.append(IOUtils.tryGetCanonicalFilePath(f)).append(File.pathSeparator);
|
||||
if (options.isCanceledWrapper())
|
||||
res.add("-cp");
|
||||
res.add("-cp");
|
||||
res.add(library.toString().substring(0, library.length() - File.pathSeparator.length()));
|
||||
String mainClass = version.mainClass;
|
||||
res.add((options.isCanceledWrapper() ? "" : "-mainClass=") + mainClass);
|
||||
res.add(version.mainClass);
|
||||
|
||||
String[] splitted = StrUtils.tokenize(version.minecraftArguments);
|
||||
|
||||
|
||||
+6
-4
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.zip.ZipFile;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
@@ -46,6 +47,7 @@ import org.jackhuang.hellominecraft.util.system.ZipEngine;
|
||||
import org.jackhuang.hellominecraft.util.tasks.Task;
|
||||
import org.jackhuang.hellominecraft.util.ui.WebPage;
|
||||
import org.jackhuang.hellominecraft.util.MinecraftVersionRequest;
|
||||
import org.jackhuang.hellominecraft.util.tasks.NoShownTaskException;
|
||||
|
||||
/**
|
||||
* A mod pack(*.zip) includes these things:
|
||||
@@ -79,7 +81,7 @@ public final class ModpackManager {
|
||||
* @return The installing Task, may take long time, please consider
|
||||
* TaskWindow.
|
||||
*/
|
||||
public static Task install(final File input, final IMinecraftService service, final String idFUCK) {
|
||||
public static Task install(JFrame parFrame, final File input, final IMinecraftService service, final String idFUCK) {
|
||||
return new Task() {
|
||||
Collection<Task> c = new ArrayList<>();
|
||||
|
||||
@@ -109,9 +111,9 @@ public final class ModpackManager {
|
||||
msgs[0] = C.i18n("modpack.task.install");
|
||||
msgs[1] = new WebPage(description);
|
||||
((WebPage) msgs[1]).setPreferredSize(new Dimension(800, 350));
|
||||
int result = JOptionPane.showOptionDialog(null, msgs, (String) msgs[0], JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
|
||||
int result = JOptionPane.showOptionDialog(parFrame, msgs, (String) msgs[0], JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
|
||||
if (result == JOptionPane.NO_OPTION)
|
||||
return;
|
||||
throw new NoShownTaskException("Operation was canceled by user.");
|
||||
|
||||
File versions = new File(service.baseDirectory(), "versions");
|
||||
|
||||
@@ -166,7 +168,7 @@ public final class ModpackManager {
|
||||
if (mv.jar == null)
|
||||
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;
|
||||
FileUtils.writeStringToFile(json, C.GSON.toJson(mv));
|
||||
if (!json.renameTo(new File(nowFile, id + ".json")))
|
||||
|
||||
+3
-1
@@ -45,7 +45,9 @@ public abstract class IMinecraftAssetService extends IMinecraftBasicService {
|
||||
*/
|
||||
public abstract boolean refreshAssetsIndex(String a);
|
||||
|
||||
public abstract boolean downloadMinecraftAssetsIndex(AssetIndexDownloadInfo assetsId);
|
||||
public abstract boolean downloadMinecraftAssetsIndexAsync(AssetIndexDownloadInfo assetsId);
|
||||
|
||||
public abstract Task downloadMinecraftAssetsIndex(AssetIndexDownloadInfo assetsId);
|
||||
|
||||
public abstract File getAssetObject(String assetVersion, String name) throws IOException;
|
||||
}
|
||||
+2
-6
@@ -22,9 +22,7 @@ import java.util.List;
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadLibraryJob;
|
||||
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.launcher.core.download.MinecraftRemoteVersion;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -38,11 +36,9 @@ public abstract class IMinecraftDownloadService extends IMinecraftBasicService {
|
||||
|
||||
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 boolean downloadMinecraftVersionJson(String id);
|
||||
public abstract Task downloadMinecraftVersionJson(String id);
|
||||
|
||||
/**
|
||||
* Get the libraries that need to download.
|
||||
|
||||
+2
-5
@@ -36,11 +36,8 @@ public class AssetIndexDownloadInfo extends GameDownloadInfo {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrl(DownloadType dt, boolean allowSelf) {
|
||||
if (url != null && dt.getProvider().isAllowedToUseSelfURL())
|
||||
return url;
|
||||
else
|
||||
return dt.getProvider().getIndexesDownloadURL() + id + ".json";
|
||||
public String getCustomizedURL(DownloadType dt) {
|
||||
return dt.getProvider().getIndexesDownloadURL() + id + ".json";
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
|
||||
+6
-2
@@ -55,9 +55,13 @@ public class GameDownloadInfo implements Cloneable {
|
||||
*/
|
||||
public String getUrl(DownloadType dt, boolean allowSelf) {
|
||||
if (url != null && allowSelf)
|
||||
return url;
|
||||
return dt.getProvider().getParsedDownloadURL(url);
|
||||
else
|
||||
return dt.getProvider().getVersionsDownloadURL() + id + "/" + id + ".jar";
|
||||
return getCustomizedURL(dt);
|
||||
}
|
||||
|
||||
protected String getCustomizedURL(DownloadType dt) {
|
||||
return dt.getProvider().getVersionsDownloadURL() + id + "/" + id + ".jar";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-1
@@ -89,6 +89,8 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
|
||||
public String formatName() {
|
||||
String[] s = name.split(":");
|
||||
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)
|
||||
sb.append('-').append(getNative());
|
||||
@@ -120,8 +122,11 @@ public class MinecraftLibrary extends IMinecraftLibrary {
|
||||
downloads.artifact = info = new LibraryDownloadInfo();
|
||||
else
|
||||
info = downloads.artifact;
|
||||
if (StrUtils.isBlank(info.path))
|
||||
if (StrUtils.isBlank(info.path)) {
|
||||
info.path = formatName();
|
||||
if (info.path == null)
|
||||
return null;
|
||||
}
|
||||
info.forgeURL = this.url;
|
||||
return info;
|
||||
}
|
||||
|
||||
+4
@@ -168,4 +168,8 @@ public class MinecraftVersion implements Cloneable, Comparable<MinecraftVersion>
|
||||
i.id = id;
|
||||
return i;
|
||||
}
|
||||
|
||||
public Set<IMinecraftLibrary> getLibraries() {
|
||||
return libraries == null ? new HashSet() : new HashSet(libraries);
|
||||
}
|
||||
}
|
||||
-2
@@ -31,9 +31,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftProvider;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.core.MCUtils;
|
||||
import org.jackhuang.hellominecraft.util.tasks.DecompressTask;
|
||||
import org.jackhuang.hellominecraft.util.tasks.TaskWindow;
|
||||
import org.jackhuang.hellominecraft.util.tasks.download.FileDownloadTask;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.io.File;
|
||||
import org.jackhuang.hellominecraft.launcher.api.PluginManager;
|
||||
import org.jackhuang.hellominecraft.launcher.core.MCUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersion;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.StrUtils;
|
||||
import org.jackhuang.hellominecraft.util.EventHandler;
|
||||
@@ -45,15 +46,19 @@ public final class Profile {
|
||||
}
|
||||
|
||||
public Profile(String name) {
|
||||
this(name, new File(IOUtils.currentDir(), ".minecraft").getPath());
|
||||
}
|
||||
|
||||
public Profile(String name, String gameDir) {
|
||||
this.name = name;
|
||||
gameDir = MCUtils.getInitGameDir().getPath();
|
||||
this.gameDir = gameDir;
|
||||
}
|
||||
|
||||
public Profile(String name, Profile v) {
|
||||
this();
|
||||
if (v == null)
|
||||
return;
|
||||
name = v.name;
|
||||
this.name = name;
|
||||
gameDir = v.gameDir;
|
||||
}
|
||||
|
||||
@@ -87,8 +92,9 @@ public final class Profile {
|
||||
public String getSelectedVersion() {
|
||||
String v = selectedMinecraftVersion;
|
||||
if (StrUtils.isBlank(v) || service().version().getVersionById(v) == null || service().version().getVersionById(v).hidden) {
|
||||
if (service().version().getVersionCount() > 0)
|
||||
v = service().version().getOneVersion(t -> !t.hidden).id;
|
||||
MinecraftVersion mv = service().version().getOneVersion(t -> !t.hidden);
|
||||
if (mv != null)
|
||||
v = mv.id;
|
||||
if (StrUtils.isNotBlank(v))
|
||||
setSelectedMinecraftVersion(v);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.launcher.Main;
|
||||
import org.jackhuang.hellominecraft.launcher.core.MCUtils;
|
||||
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
|
||||
import org.jackhuang.hellominecraft.util.CollectionUtils;
|
||||
import org.jackhuang.hellominecraft.util.EventHandler;
|
||||
@@ -40,6 +41,7 @@ import org.jackhuang.hellominecraft.util.UpdateChecker;
|
||||
public final class Settings {
|
||||
|
||||
public static final String DEFAULT_PROFILE = "Default";
|
||||
public static final String HOME_PROFILE = "Home";
|
||||
|
||||
public static final File SETTINGS_FILE = new File(IOUtils.currentDir(), "hmcl.json");
|
||||
|
||||
@@ -55,7 +57,7 @@ public final class Settings {
|
||||
SETTINGS.downloadTypeChangedEvent.register(DownloadType::setSuggestedDownloadType);
|
||||
DownloadType.setSuggestedDownloadType(SETTINGS.getDownloadSource());
|
||||
if (!getProfiles().containsKey(DEFAULT_PROFILE))
|
||||
getProfiles().put(DEFAULT_PROFILE, new Profile());
|
||||
getProfiles().put(DEFAULT_PROFILE, new Profile(DEFAULT_PROFILE));
|
||||
|
||||
for (Map.Entry<String, Profile> entry : getProfiles().entrySet()) {
|
||||
Profile e = entry.getValue();
|
||||
@@ -81,8 +83,11 @@ public final class Settings {
|
||||
} catch (IOException | JsonSyntaxException e) {
|
||||
HMCLog.warn("Something happened wrongly when load settings.", e);
|
||||
}
|
||||
else
|
||||
else {
|
||||
HMCLog.log("No settings file here, may be first loading.");
|
||||
if (!c.getConfigurations().containsKey(HOME_PROFILE))
|
||||
c.getConfigurations().put(HOME_PROFILE, new Profile(HOME_PROFILE, MCUtils.getLocation().getPath()));
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -150,7 +155,13 @@ public final class Settings {
|
||||
MessageBox.Show(C.i18n("settings.cannot_remove_default_config"));
|
||||
return false;
|
||||
}
|
||||
return getProfiles().remove(ver) != null;
|
||||
boolean notify = false;
|
||||
if (getLastProfile().getName().equals(ver))
|
||||
notify = true;
|
||||
boolean flag = getProfiles().remove(ver) != null;
|
||||
if (notify && flag)
|
||||
onProfileChanged();
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static final EventHandler<Profile> profileChangedEvent = new EventHandler(null);
|
||||
|
||||
+15
-26
@@ -40,8 +40,8 @@ public class VersionSetting {
|
||||
public transient String id;
|
||||
|
||||
private String javaArgs, minecraftArgs, maxMemory, permSize, width, height;
|
||||
private String javaDir, precalledCommand, serverIp, java;
|
||||
private boolean fullscreen, debug, noJVMArgs, canceledWrapper;
|
||||
private String javaDir, precalledCommand, serverIp, java, wrapper;
|
||||
private boolean fullscreen, noJVMArgs;
|
||||
|
||||
/**
|
||||
* 0 - Close the launcher when the game starts.<br/>
|
||||
@@ -59,10 +59,10 @@ public class VersionSetting {
|
||||
public transient final EventHandler<String> propertyChanged = new EventHandler<>(this);
|
||||
|
||||
public VersionSetting() {
|
||||
debug = fullscreen = canceledWrapper = false;
|
||||
fullscreen = false;
|
||||
launcherVisibility = 1;
|
||||
gameDirType = 0;
|
||||
javaDir = java = minecraftArgs = serverIp = precalledCommand = "";
|
||||
javaDir = java = minecraftArgs = serverIp = precalledCommand = wrapper = "";
|
||||
}
|
||||
|
||||
public VersionSetting(VersionSetting v) {
|
||||
@@ -76,14 +76,13 @@ public class VersionSetting {
|
||||
fullscreen = v.fullscreen;
|
||||
javaArgs = v.javaArgs;
|
||||
javaDir = v.javaDir;
|
||||
debug = v.debug;
|
||||
minecraftArgs = v.minecraftArgs;
|
||||
permSize = v.permSize;
|
||||
gameDirType = v.gameDirType;
|
||||
canceledWrapper = v.canceledWrapper;
|
||||
noJVMArgs = v.noJVMArgs;
|
||||
launcherVisibility = v.launcherVisibility;
|
||||
precalledCommand = v.precalledCommand;
|
||||
wrapper = v.wrapper;
|
||||
serverIp = v.serverIp;
|
||||
}
|
||||
|
||||
@@ -192,15 +191,6 @@ public class VersionSetting {
|
||||
propertyChanged.execute("fullscreen");
|
||||
}
|
||||
|
||||
public boolean isDebug() {
|
||||
return debug;
|
||||
}
|
||||
|
||||
public void setDebug(boolean debug) {
|
||||
this.debug = debug;
|
||||
propertyChanged.execute("debug");
|
||||
}
|
||||
|
||||
public LauncherVisibility getLauncherVisibility() {
|
||||
return LauncherVisibility.values()[launcherVisibility];
|
||||
}
|
||||
@@ -248,15 +238,6 @@ public class VersionSetting {
|
||||
propertyChanged.execute("minecraftArgs");
|
||||
}
|
||||
|
||||
public boolean isCanceledWrapper() {
|
||||
return canceledWrapper;
|
||||
}
|
||||
|
||||
public void setCanceledWrapper(boolean canceledWrapper) {
|
||||
this.canceledWrapper = canceledWrapper;
|
||||
propertyChanged.execute("canceledWrapper");
|
||||
}
|
||||
|
||||
public String getPrecalledCommand() {
|
||||
return precalledCommand;
|
||||
}
|
||||
@@ -266,6 +247,15 @@ public class VersionSetting {
|
||||
propertyChanged.execute("precalledCommand");
|
||||
}
|
||||
|
||||
public String getWrapper() {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
public void setWrapper(String wrapper) {
|
||||
this.wrapper = wrapper;
|
||||
propertyChanged.execute("wrapper");
|
||||
}
|
||||
|
||||
public String getServerIp() {
|
||||
return serverIp;
|
||||
}
|
||||
@@ -277,9 +267,8 @@ public class VersionSetting {
|
||||
|
||||
public LaunchOptions createLaunchOptions(File gameDir) {
|
||||
LaunchOptions x = new LaunchOptions();
|
||||
x.setCanceledWrapper(isCanceledWrapper());
|
||||
x.setDebug(isDebug());
|
||||
x.setFullscreen(isFullscreen());
|
||||
x.setWrapper(getWrapper());
|
||||
x.setGameDir(gameDir);
|
||||
x.setGameDirType(getGameDirType());
|
||||
x.setHeight(getHeight());
|
||||
|
||||
+50
-57
@@ -63,7 +63,7 @@
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="402" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="576" max="32767" attributes="0"/>
|
||||
<Component id="btnIncludeMinecraft" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -195,7 +195,7 @@
|
||||
<Component id="lblDimension" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="txtWidth" alignment="3" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="54" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="228" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnDownloadAllAssets" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnCleanGame" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -389,39 +389,40 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtPrecalledCommand" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="txtServerIP" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblPrecalledCommand" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="chkDebug" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkCancelWrapper" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblServerIP" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="txtWrapperLauncher" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPrecalledCommand1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblMinecraftArgs" alignment="0" min="-2" max="-2" 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>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="txtPrecalledCommand" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="txtServerIP" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblMinecraftArgs" alignment="0" min="-2" max="-2" 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>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtJavaArgs" pref="664" max="32767" attributes="0"/>
|
||||
<Component id="txtMinecraftArgs" max="32767" attributes="0"/>
|
||||
<Component id="txtPermSize" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" 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"/>
|
||||
<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>
|
||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -444,6 +445,10 @@
|
||||
<Component id="lblPermSize" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPrecalledCommand1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtWrapperLauncher" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPrecalledCommand" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPrecalledCommand" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
@@ -451,28 +456,14 @@
|
||||
<Component id="lblServerIP" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtServerIP" min="-2" pref="26" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="46" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="chkDebug" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkNoJVMArgs" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkCancelWrapper" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="168" max="32767" attributes="0"/>
|
||||
<Component id="chkNoJVMArgs" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JCheckBox" name="chkDebug">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="advancedsettings.debug_mode" replaceFormat="C.i18n("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="chkDebugItemStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblJavaArgs">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
@@ -524,20 +515,10 @@
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="chkNoJVMArgsItemStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="chkCancelWrapper">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="advancedsettings.cancel_wrapper_launcher" replaceFormat="C.i18n("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="chkCancelWrapperItemStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblPrecalledCommand">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/launcher/I18N.properties" key="advancedsettings.wrapper_launcher" replaceFormat="C.i18n("{key}")"/>
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/lang/I18N.properties" key="advancedsettings.precall_command" replaceFormat="C.i18n("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
@@ -558,6 +539,18 @@
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="txtServerIPFocusLost"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblPrecalledCommand1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/lang/I18N.properties" key="advancedsettings.wrapper_launcher" replaceFormat="C.i18n("{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtWrapperLauncher">
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="txtWrapperLauncherFocusLost"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="pnlModManagement">
|
||||
@@ -616,7 +609,7 @@
|
||||
<Component id="btnRemoveMod" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" pref="254" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="428" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblModInfo" min="-2" max="-2" attributes="0"/>
|
||||
|
||||
+62
-68
@@ -64,6 +64,7 @@ import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.ui.SwingUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.Java;
|
||||
import org.jackhuang.hellominecraft.util.tasks.TaskWindow;
|
||||
import org.jackhuang.hellominecraft.util.ui.LogWindow;
|
||||
|
||||
/**
|
||||
@@ -276,7 +277,6 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
btnChoosingGameDir = new javax.swing.JButton();
|
||||
btnCleanGame = new javax.swing.JButton();
|
||||
pnlAdvancedSettings = new AnimatedPanel();
|
||||
chkDebug = new javax.swing.JCheckBox();
|
||||
lblJavaArgs = new javax.swing.JLabel();
|
||||
txtJavaArgs = new javax.swing.JTextField();
|
||||
txtMinecraftArgs = new javax.swing.JTextField();
|
||||
@@ -284,11 +284,12 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
lblPermSize = new javax.swing.JLabel();
|
||||
txtPermSize = new javax.swing.JTextField();
|
||||
chkNoJVMArgs = new javax.swing.JCheckBox();
|
||||
chkCancelWrapper = new javax.swing.JCheckBox();
|
||||
lblPrecalledCommand = new javax.swing.JLabel();
|
||||
txtPrecalledCommand = new javax.swing.JTextField();
|
||||
lblServerIP = new javax.swing.JLabel();
|
||||
txtServerIP = new javax.swing.JTextField();
|
||||
lblPrecalledCommand1 = new javax.swing.JLabel();
|
||||
txtWrapperLauncher = new javax.swing.JTextField();
|
||||
pnlModManagement = new AnimatedPanel();
|
||||
pnlModManagementContent = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
@@ -505,7 +506,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addComponent(lblDimensionX, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDimension)
|
||||
.addComponent(txtWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 228, Short.MAX_VALUE)
|
||||
.addGroup(pnlSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnDownloadAllAssets)
|
||||
.addComponent(btnCleanGame))
|
||||
@@ -514,13 +515,6 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
|
||||
tabVersionEdit.addTab(C.i18n("settings"), pnlSettings); // NOI18N
|
||||
|
||||
chkDebug.setText(C.i18n("advancedsettings.debug_mode")); // NOI18N
|
||||
chkDebug.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
chkDebugItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lblJavaArgs.setText(C.i18n("advancedsettings.jvm_args")); // NOI18N
|
||||
|
||||
txtJavaArgs.setToolTipText(C.i18n("advancedsettings.java_args_default")); // NOI18N
|
||||
@@ -553,14 +547,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
}
|
||||
});
|
||||
|
||||
chkCancelWrapper.setText(C.i18n("advancedsettings.cancel_wrapper_launcher")); // NOI18N
|
||||
chkCancelWrapper.addItemListener(new java.awt.event.ItemListener() {
|
||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
||||
chkCancelWrapperItemStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
lblPrecalledCommand.setText(C.i18n("advancedsettings.wrapper_launcher")); // NOI18N
|
||||
lblPrecalledCommand.setText(C.i18n("advancedsettings.precall_command")); // NOI18N
|
||||
|
||||
txtPrecalledCommand.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
@@ -576,37 +563,47 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
}
|
||||
});
|
||||
|
||||
lblPrecalledCommand1.setText(C.i18n("advancedsettings.wrapper_launcher")); // NOI18N
|
||||
|
||||
txtWrapperLauncher.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
txtWrapperLauncherFocusLost(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout pnlAdvancedSettingsLayout = new javax.swing.GroupLayout(pnlAdvancedSettings);
|
||||
pnlAdvancedSettings.setLayout(pnlAdvancedSettingsLayout);
|
||||
pnlAdvancedSettingsLayout.setHorizontalGroup(
|
||||
pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtWrapperLauncher)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addComponent(lblPrecalledCommand1)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
.addComponent(txtPrecalledCommand)
|
||||
.addComponent(txtServerIP)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPrecalledCommand)
|
||||
.addComponent(lblServerIP))
|
||||
.addGap(0, 716, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMinecraftArgs)
|
||||
.addComponent(lblPermSize)
|
||||
.addComponent(lblJavaArgs))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtJavaArgs)
|
||||
.addComponent(txtMinecraftArgs)
|
||||
.addComponent(txtPermSize, javax.swing.GroupLayout.Alignment.TRAILING))))
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtPrecalledCommand)
|
||||
.addComponent(txtServerIP)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblPrecalledCommand)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addComponent(chkDebug)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkCancelWrapper)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(chkNoJVMArgs))
|
||||
.addComponent(lblServerIP))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlAdvancedSettingsLayout.createSequentialGroup()
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMinecraftArgs)
|
||||
.addComponent(lblPermSize)
|
||||
.addComponent(lblJavaArgs))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtJavaArgs)
|
||||
.addComponent(txtMinecraftArgs)
|
||||
.addComponent(txtPermSize, javax.swing.GroupLayout.Alignment.TRAILING))))
|
||||
.addGap(0, 0, 0))
|
||||
.addContainerGap()
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
);
|
||||
pnlAdvancedSettingsLayout.setVerticalGroup(
|
||||
pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -624,6 +621,10 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addComponent(txtPermSize, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblPermSize))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPrecalledCommand1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtWrapperLauncher, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblPrecalledCommand)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPrecalledCommand, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
@@ -631,11 +632,8 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addComponent(lblServerIP)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtServerIP, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
|
||||
.addGroup(pnlAdvancedSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(chkDebug)
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addComponent(chkCancelWrapper))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 168, Short.MAX_VALUE)
|
||||
.addComponent(chkNoJVMArgs)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -697,7 +695,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnRemoveMod)
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 254, Short.MAX_VALUE))
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblModInfo))
|
||||
);
|
||||
@@ -930,7 +928,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
.addContainerGap())
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(402, Short.MAX_VALUE)
|
||||
.addContainerGap(576, Short.MAX_VALUE)
|
||||
.addComponent(btnIncludeMinecraft)
|
||||
.addContainerGap()))
|
||||
);
|
||||
@@ -951,8 +949,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
private void btnRemoveProfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveProfileActionPerformed
|
||||
if (MessageBox.Show(C.i18n("ui.message.sure_remove", Settings.getLastProfile().getName()), MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION)
|
||||
return;
|
||||
if (Settings.delProfile(Settings.getLastProfile()))
|
||||
loadProfiles();
|
||||
Settings.delProfile(Settings.getLastProfile());
|
||||
}//GEN-LAST:event_btnRemoveProfileActionPerformed
|
||||
|
||||
private void cboVersionsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboVersionsItemStateChanged
|
||||
@@ -975,7 +972,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
|
||||
private void btnDownloadAllAssetsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadAllAssetsActionPerformed
|
||||
if (mcVersion != null)
|
||||
Settings.getLastProfile().service().asset().downloadAssets(mcVersion).run();
|
||||
TaskWindow.execute(Settings.getLastProfile().service().asset().downloadAssets(mcVersion));
|
||||
}//GEN-LAST:event_btnDownloadAllAssetsActionPerformed
|
||||
|
||||
private void txtGameDirFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtGameDirFocusLost
|
||||
@@ -1116,16 +1113,6 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setFullscreen(chkFullscreen.isSelected());
|
||||
}//GEN-LAST:event_chkFullscreenItemStateChanged
|
||||
|
||||
private void chkDebugItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkDebugItemStateChanged
|
||||
if (!isLoading)
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setDebug(chkDebug.isSelected());
|
||||
}//GEN-LAST:event_chkDebugItemStateChanged
|
||||
|
||||
private void chkCancelWrapperItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkCancelWrapperItemStateChanged
|
||||
if (!isLoading)
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setCanceledWrapper(chkCancelWrapper.isSelected());
|
||||
}//GEN-LAST:event_chkCancelWrapperItemStateChanged
|
||||
|
||||
private void chkNoJVMArgsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_chkNoJVMArgsItemStateChanged
|
||||
if (!isLoading)
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setNoJVMArgs(chkNoJVMArgs.isSelected());
|
||||
@@ -1167,6 +1154,10 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setServerIp(txtServerIP.getText());
|
||||
}//GEN-LAST:event_txtServerIPFocusLost
|
||||
|
||||
private void txtWrapperLauncherFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtWrapperLauncherFocusLost
|
||||
Settings.getLastProfile().getSelectedVersionSetting().setWrapper(txtWrapperLauncher.getText());
|
||||
}//GEN-LAST:event_txtWrapperLauncherFocusLost
|
||||
|
||||
// </editor-fold>
|
||||
// <editor-fold defaultstate="collapsed" desc="Load">
|
||||
void prepareVersionSetting(VersionSetting profile) {
|
||||
@@ -1181,10 +1172,8 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
txtMinecraftArgs.setText(profile.getMinecraftArgs());
|
||||
txtPrecalledCommand.setText(profile.getPrecalledCommand());
|
||||
txtServerIP.setText(profile.getServerIp());
|
||||
chkDebug.setSelected(profile.isDebug());
|
||||
chkNoJVMArgs.setSelected(profile.isNoJVMArgs());
|
||||
chkFullscreen.setSelected(profile.isFullscreen());
|
||||
chkCancelWrapper.setSelected(profile.isCanceledWrapper());
|
||||
cboLauncherVisibility.setSelectedIndex(profile.getLauncherVisibility().ordinal());
|
||||
cboRunDirectory.setSelectedIndex(profile.getGameDirType().ordinal());
|
||||
cboJava.setSelectedIndex(profile.getJavaIndexInAllJavas());
|
||||
@@ -1334,8 +1323,6 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
private javax.swing.JComboBox cboProfiles;
|
||||
private javax.swing.JComboBox cboRunDirectory;
|
||||
private javax.swing.JComboBox cboVersions;
|
||||
private javax.swing.JCheckBox chkCancelWrapper;
|
||||
private javax.swing.JCheckBox chkDebug;
|
||||
private javax.swing.JCheckBox chkFullscreen;
|
||||
private javax.swing.JCheckBox chkNoJVMArgs;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
@@ -1351,6 +1338,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
private javax.swing.JLabel lblModInfo;
|
||||
private javax.swing.JLabel lblPermSize;
|
||||
private javax.swing.JLabel lblPrecalledCommand;
|
||||
private javax.swing.JLabel lblPrecalledCommand1;
|
||||
private javax.swing.JLabel lblProfile;
|
||||
private javax.swing.JLabel lblRunDirectory;
|
||||
private javax.swing.JLabel lblServerIP;
|
||||
@@ -1377,6 +1365,7 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
private javax.swing.JTextField txtPrecalledCommand;
|
||||
private javax.swing.JTextField txtServerIP;
|
||||
private javax.swing.JTextField txtWidth;
|
||||
private javax.swing.JTextField txtWrapperLauncher;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private javax.swing.JPanel pnlGameDownloads;
|
||||
@@ -1386,10 +1375,12 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
final Runnable onLoadingProfiles = this::loadProfiles;
|
||||
|
||||
private void loadProfiles() {
|
||||
isLoading = true;
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
||||
for (Profile s : Settings.getProfilesFiltered())
|
||||
model.addElement(s.getName());
|
||||
cboProfiles.setModel(model);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
final Consumer<IMinecraftService> onRefreshedVersions = t -> {
|
||||
@@ -1435,12 +1426,15 @@ public final class GameSettingsPanel extends AnimatedPanel implements DropTarget
|
||||
t.selectedVersionChangedEvent.register(selectedVersionChangedEvent);
|
||||
|
||||
txtGameDir.setText(t.getGameDir());
|
||||
|
||||
isLoading = true;
|
||||
DefaultComboBoxModel model = (DefaultComboBoxModel) cboProfiles.getModel();
|
||||
for (int i = 0; i < model.getSize(); ++i)
|
||||
if (model.getElementAt(i).equals(t.getName())) {
|
||||
model.setSelectedItem(t.getName());
|
||||
break;
|
||||
}
|
||||
isLoading = false;
|
||||
};
|
||||
//</editor-fold>
|
||||
}
|
||||
@@ -153,7 +153,13 @@
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/jackhuang/hellominecraft/lang/I18N.properties" key="launcher.about" replaceFormat="C.i18n("{key}")"/>
|
||||
</Property>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="手型光标"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="lblAboutMouseClicked"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnSelBackgroundPath">
|
||||
<Properties>
|
||||
|
||||
+11
-1
@@ -124,6 +124,12 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
});
|
||||
|
||||
lblAbout.setText(C.i18n("launcher.about")); // NOI18N
|
||||
lblAbout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
|
||||
lblAbout.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||
lblAboutMouseClicked(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnSelBackgroundPath.setText(C.i18n("ui.button.explore")); // NOI18N
|
||||
btnSelBackgroundPath.addActionListener(new java.awt.event.ActionListener() {
|
||||
@@ -380,7 +386,7 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
}//GEN-LAST:event_cboThemeItemStateChanged
|
||||
|
||||
private void lblModpackMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblModpackMouseClicked
|
||||
SwingUtils.openLink("http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/");
|
||||
SwingUtils.openLink("http://huangyuhui.duapp.com/link.php?type=modpack");
|
||||
}//GEN-LAST:event_lblModpackMouseClicked
|
||||
|
||||
private void cboLangItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboLangItemStateChanged
|
||||
@@ -415,6 +421,10 @@ public class LauncherSettingsPanel extends AnimatedPanel {
|
||||
Settings.getInstance().setProxyPassword(txtProxyPassword.getText());
|
||||
}//GEN-LAST:event_txtProxyPasswordFocusLost
|
||||
|
||||
private void lblAboutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblAboutMouseClicked
|
||||
SwingUtils.openLink("http://huangyuhui.duapp.com/link.php?type=sponsor");
|
||||
}//GEN-LAST:event_lblAboutMouseClicked
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnCheckUpdate;
|
||||
private javax.swing.JButton btnSelBackgroundPath;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.launcher.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
@@ -25,11 +26,13 @@ import org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher;
|
||||
import org.jackhuang.hellominecraft.launcher.core.launch.LaunchingState;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Profile;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Settings;
|
||||
import org.jackhuang.hellominecraft.launcher.util.MinecraftCrashAdvicer;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.Event;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.func.Consumer;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.JavaProcessMonitor;
|
||||
import org.jackhuang.hellominecraft.util.ui.LogWindow;
|
||||
import org.jackhuang.hellominecraft.util.ui.WebFrame;
|
||||
@@ -95,8 +98,20 @@ public class LaunchingUIDaemon {
|
||||
JavaProcessMonitor jpm = new JavaProcessMonitor(p);
|
||||
jpm.applicationExitedAbnormallyEvent.register(t -> {
|
||||
HMCLog.err("The game exited abnormally, exit code: " + t);
|
||||
MessageBox.Show(C.i18n("launch.exited_abnormally") + " exit code: " + t);
|
||||
WebFrame f = new WebFrame(jpm.getJavaProcess().getStdOutLines().toArray(new String[0]));
|
||||
String[] logs = jpm.getJavaProcess().getStdOutLines().toArray(new String[0]);
|
||||
String errorText = null;
|
||||
for (String s : logs) {
|
||||
int pos = s.lastIndexOf("#@!@#");
|
||||
if (pos >= 0 && pos < s.length() - "#@!@#".length() - 1) {
|
||||
errorText = s.substring(pos + "#@!@#".length()).trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
String msg = C.i18n("launch.exited_abnormally") + " exit code: " + t;
|
||||
if (errorText != null)
|
||||
msg += ", advice: " + MinecraftCrashAdvicer.getAdvice(FileUtils.readFileToStringQuietly(new File(errorText)));
|
||||
MessageBox.Show(msg);
|
||||
WebFrame f = new WebFrame(logs);
|
||||
f.setModal(true);
|
||||
f.setTitle("Game output");
|
||||
f.setVisible(true);
|
||||
@@ -123,9 +138,15 @@ public class LaunchingUIDaemon {
|
||||
return true;
|
||||
};
|
||||
|
||||
private static void getCrashReport() {
|
||||
|
||||
}
|
||||
|
||||
private static void checkExit(LauncherVisibility v) {
|
||||
if (v != LauncherVisibility.KEEP && !LogWindow.INSTANCE.isVisible())
|
||||
if (v != LauncherVisibility.KEEP && !LogWindow.INSTANCE.isVisible()) {
|
||||
HMCLog.log("Launcher will exit now.");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Event<List<String>> LAUNCH_SCRIPT_FINISHER = (sender, str) -> {
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.jackhuang.hellominecraft.launcher.setting.Settings;
|
||||
import org.jackhuang.hellominecraft.launcher.core.mod.ModpackManager;
|
||||
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
|
||||
import org.jackhuang.hellominecraft.launcher.ui.modpack.ModpackWizard;
|
||||
import org.jackhuang.hellominecraft.launcher.util.HMCLMinecraftService;
|
||||
import org.jackhuang.hellominecraft.util.ui.GraphicsUtils;
|
||||
import org.jackhuang.hellominecraft.util.Event;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.comp.ConstomButton;
|
||||
@@ -382,7 +383,7 @@ public class MainPagePanel extends AnimatedPanel {
|
||||
if (fc.getSelectedFile() == null)
|
||||
return;
|
||||
String suggestedModpackId = JOptionPane.showInputDialog("Please enter your favourite game name", FileUtils.getBaseName(fc.getSelectedFile().getName()));
|
||||
TaskWindow.factory().append(ModpackManager.install(fc.getSelectedFile(), Settings.getLastProfile().service(), suggestedModpackId)).create();
|
||||
TaskWindow.factory().append(ModpackManager.install(MainFrame.INSTANCE, fc.getSelectedFile(), Settings.getLastProfile().service(), suggestedModpackId)).create();
|
||||
Settings.getLastProfile().service().version().refreshVersions();
|
||||
}//GEN-LAST:event_btnImportModpackActionPerformed
|
||||
|
||||
@@ -471,10 +472,12 @@ public class MainPagePanel extends AnimatedPanel {
|
||||
final Runnable onLoadingProfiles = this::loadProfiles;
|
||||
|
||||
private void loadProfiles() {
|
||||
isLoading = true;
|
||||
DefaultComboBoxModel model = new DefaultComboBoxModel();
|
||||
for (Profile s : Settings.getProfilesFiltered())
|
||||
model.addElement(s.getName());
|
||||
cboProfiles.setModel(model);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
final Consumer<IMinecraftService> onRefreshedVersions = t -> {
|
||||
@@ -489,7 +492,7 @@ public class MainPagePanel extends AnimatedPanel {
|
||||
cboVersions.removeAllItems();
|
||||
String selVersion = Settings.getLastProfile().getSelectedVersion();
|
||||
if (Settings.getLastProfile().service().version().getVersions().isEmpty()) {
|
||||
if (!showedNoVersion) {
|
||||
if (!showedNoVersion && ((HMCLMinecraftService) Settings.getLastProfile().service()).checkedModpack) {
|
||||
showedNoVersion = true;
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (MessageBox.Show(C.i18n("mainwindow.no_version"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION)
|
||||
@@ -528,11 +531,13 @@ public class MainPagePanel extends AnimatedPanel {
|
||||
t.selectedVersionChangedEvent.register(versionChanged);
|
||||
t.launcher().launchingStateChanged.register(launchingStateChanged);
|
||||
|
||||
isLoading = true;
|
||||
DefaultComboBoxModel model = (DefaultComboBoxModel) cboProfiles.getModel();
|
||||
for (int i = 0; i < model.getSize(); ++i)
|
||||
if (model.getElementAt(i).equals(t.getName())) {
|
||||
model.setSelectedItem(t.getName());
|
||||
break;
|
||||
}
|
||||
isLoading = false;
|
||||
};
|
||||
}
|
||||
+4
-1
@@ -100,7 +100,10 @@ public class ModpackWizard extends WizardBranchController {
|
||||
}
|
||||
try {
|
||||
String gameVersion = (String) settings.get(ModpackInitializationPanel.KEY_GAME_VERSION);
|
||||
File loc = new File((String) settings.get(ModpackInitializationPanel.KEY_MODPACK_LOCATION));
|
||||
String strLocation = (String) settings.get(ModpackInitializationPanel.KEY_MODPACK_LOCATION);
|
||||
if (!strLocation.endsWith(".zip"))
|
||||
strLocation += ".zip";
|
||||
File loc = new File(strLocation);
|
||||
File modpack = loc;
|
||||
if ((Boolean) settings.get(ModpackInitializationPanel.KEY_INCLUDING_LAUNCHER))
|
||||
modpack = new File(loc.getAbsolutePath() + ".temp");
|
||||
|
||||
@@ -48,7 +48,8 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||
put("MessageBox", "");
|
||||
put("AWTError", "");
|
||||
put("JFileChooser", "Has your operating system been installed completely or is a ghost system? ");
|
||||
put("JceSecurityManager", "Has your operating system been installed completely or is a ghost system? ");
|
||||
put("Jce", "Has your operating system been installed completely or is a ghost system? ");
|
||||
put("couldn't create component peer", "Fucking computer!");
|
||||
put("sun.awt.shell.Win32ShellFolder2", "crash.user_fault");
|
||||
put("UnsatisfiedLinkError", "crash.user_fault");
|
||||
put("java.awt.HeadlessException", "crash.headless");
|
||||
|
||||
+14
-5
@@ -21,6 +21,7 @@ import com.google.gson.JsonSyntaxException;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.jackhuang.hellominecraft.launcher.core.GameException;
|
||||
import org.jackhuang.hellominecraft.launcher.core.install.MinecraftInstallerService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.asset.MinecraftAssetService;
|
||||
@@ -39,6 +40,7 @@ import org.jackhuang.hellominecraft.launcher.core.mod.MinecraftModService;
|
||||
import org.jackhuang.hellominecraft.launcher.core.mod.ModpackManager;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Profile;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.VersionSetting;
|
||||
import org.jackhuang.hellominecraft.launcher.ui.MainFrame;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
@@ -66,12 +68,19 @@ public class HMCLMinecraftService extends IMinecraftService {
|
||||
this.mis = new MinecraftInstallerService(this);
|
||||
}
|
||||
|
||||
public boolean checkedModpack = false, checkingModpack = false;
|
||||
|
||||
private void checkModpack() {
|
||||
if (version().getVersionCount() == 0) {
|
||||
File modpack = new File("modpack.zip");
|
||||
if (modpack.exists()) {
|
||||
TaskWindow.factory().append(ModpackManager.install(modpack, this, null)).create();
|
||||
version().refreshVersions();
|
||||
if (!checkingModpack) {
|
||||
checkingModpack = true;
|
||||
if (version().getVersionCount() == 0) {
|
||||
File modpack = new File("modpack.zip");
|
||||
if (modpack.exists())
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (TaskWindow.execute(ModpackManager.install(MainFrame.INSTANCE, modpack, this, null)))
|
||||
version().refreshVersions();
|
||||
checkedModpack = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ public final class MinecraftCrashAdvicer {
|
||||
}
|
||||
|
||||
public static String getAdvice(String trace, boolean selfCrash) {
|
||||
if (trace == null)
|
||||
return C.i18n("crash.advice.no");
|
||||
trace = trace.toLowerCase(SupportedLocales.NOW_LOCALE.self);
|
||||
if (trace.contains("pixel format not accelerated"))
|
||||
return C.i18n("crash.advice.LWJGLException");
|
||||
|
||||
@@ -93,6 +93,7 @@ public class ZipEngine {
|
||||
if (file.isDirectory()) {
|
||||
pathName = file.getPath().substring(basePath.length() + 1)
|
||||
+ "/";
|
||||
pathName = pathName.replace('\\', '/');
|
||||
if (pathNameCallback != null)
|
||||
pathName = pathNameCallback.apply(pathName, true);
|
||||
if (pathName == null)
|
||||
@@ -100,9 +101,10 @@ public class ZipEngine {
|
||||
zos.putNextEntry(new ZipEntry(pathName));
|
||||
putDirectoryImpl(file, basePath, pathNameCallback);
|
||||
} else {
|
||||
if (".DS_Store".equals(file.getName())) // For mac computers.
|
||||
if (".DS_Store".equals(file.getName())) // For Mac computers.
|
||||
continue;
|
||||
pathName = file.getPath().substring(basePath.length() + 1);
|
||||
pathName = pathName.replace('\\', '/');
|
||||
if (pathNameCallback != null)
|
||||
pathName = pathNameCallback.apply(pathName, false);
|
||||
if (pathName == null)
|
||||
|
||||
+29
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,8 @@ public abstract class Task {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean areDependTasksSucceeded;
|
||||
|
||||
protected ProgressProviderListener ppl;
|
||||
|
||||
public Task setProgressProviderListener(ProgressProviderListener p) {
|
||||
@@ -110,9 +112,21 @@ public abstract class Task {
|
||||
return new DoubleTask(t, this);
|
||||
}
|
||||
|
||||
public void runWithException() throws Throwable {
|
||||
Collection<Task> c = getDependTasks();
|
||||
if (c != null)
|
||||
for (Task t : c)
|
||||
t.runWithException();
|
||||
executeTask();
|
||||
c = getAfterTasks();
|
||||
if (c != null)
|
||||
for (Task t : c)
|
||||
t.runWithException();
|
||||
}
|
||||
|
||||
public boolean run() {
|
||||
try {
|
||||
executeTask();
|
||||
runWithException();
|
||||
return true;
|
||||
} catch (Throwable t) {
|
||||
HMCLog.err("Failed to execute task", t);
|
||||
|
||||
@@ -24,10 +24,11 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
|
||||
/**
|
||||
@@ -71,17 +72,20 @@ public class TaskList extends Thread {
|
||||
private class Invoker implements Runnable {
|
||||
|
||||
Task task;
|
||||
Set<Invoker> s;
|
||||
CountDownLatch latch;
|
||||
AtomicBoolean bool;
|
||||
|
||||
public Invoker(Task task, Set<Invoker> ss) {
|
||||
public Invoker(Task task, CountDownLatch latch, AtomicBoolean bool) {
|
||||
this.task = task;
|
||||
s = ss;
|
||||
this.latch = latch;
|
||||
this.bool = bool;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
executeTask(task);
|
||||
s.remove(this);
|
||||
if (!executeTask(task))
|
||||
bool.set(false);
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -90,32 +94,31 @@ public class TaskList extends Thread {
|
||||
HashMap<Invoker, Future<?>> futures = new HashMap<>();
|
||||
HashSet<Invoker> invokers = new HashSet<>();
|
||||
|
||||
private void processTasks(Collection<? extends Task> c) {
|
||||
private boolean processTasks(Collection<? extends Task> c) {
|
||||
if (c == null || c.isEmpty())
|
||||
return;
|
||||
return true;
|
||||
this.totTask += c.size();
|
||||
Set<Invoker> runningThread = Collections.synchronizedSet(new HashSet<Invoker>());
|
||||
AtomicBoolean bool = new AtomicBoolean(true);
|
||||
CountDownLatch counter = new CountDownLatch(c.size());
|
||||
for (Task t2 : c) {
|
||||
t2.setParallelExecuting(true);
|
||||
Invoker thread = new Invoker(t2, runningThread);
|
||||
runningThread.add(thread);
|
||||
Invoker thread = new Invoker(t2, counter, bool);
|
||||
invokers.add(thread);
|
||||
if (!EXECUTOR_SERVICE.isTerminated())
|
||||
if (!EXECUTOR_SERVICE.isShutdown() && !EXECUTOR_SERVICE.isTerminated())
|
||||
futures.put(thread, EXECUTOR_SERVICE.submit(thread));
|
||||
}
|
||||
while (!runningThread.isEmpty())
|
||||
try {
|
||||
if (this.isInterrupted())
|
||||
return;
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException ignore) {
|
||||
}
|
||||
|
||||
try {
|
||||
counter.await();
|
||||
} catch (InterruptedException ignore) {
|
||||
}
|
||||
return bool.get();
|
||||
}
|
||||
|
||||
private void executeTask(Task t) {
|
||||
if (!shouldContinue || t == null)
|
||||
return;
|
||||
private boolean executeTask(Task t) {
|
||||
if (!shouldContinue)
|
||||
return false;
|
||||
if (t == null)
|
||||
return true;
|
||||
|
||||
Collection<Task> c = t.getDependTasks();
|
||||
if (c == null)
|
||||
@@ -125,7 +128,7 @@ public class TaskList extends Thread {
|
||||
d.onDoing(t, c);
|
||||
for (DoingDoneListener<Task> d : taskListener)
|
||||
d.onDoing(t, c);
|
||||
processTasks(c);
|
||||
t.areDependTasksSucceeded = processTasks(c);
|
||||
|
||||
boolean flag = true;
|
||||
try {
|
||||
@@ -151,6 +154,7 @@ public class TaskList extends Thread {
|
||||
for (DoingDoneListener<Task> d : t.getTaskListeners())
|
||||
d.onFailed(t);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -176,7 +180,7 @@ public class TaskList extends Thread {
|
||||
while (!in.isEmpty())
|
||||
synchronized (in) {
|
||||
Invoker it = in.iterator().next();
|
||||
if (!it.task.abort())
|
||||
if (!it.task.abort() && futures.get(it) != null)
|
||||
futures.get(it).cancel(true);
|
||||
in.remove(it);
|
||||
}
|
||||
|
||||
@@ -225,9 +225,11 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(this::dispose);
|
||||
suc = true;
|
||||
HMCLog.log("Tasks are finished.");
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
dispose();
|
||||
suc = true;
|
||||
HMCLog.log("Tasks are finished.");
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,7 +273,14 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
if (taskList == null || task == null)
|
||||
return;
|
||||
failReasons.add(task.getInfo() + ": " + (null == task.getFailReason() ? "No exception" : (StrUtils.isBlank(task.getFailReason().getLocalizedMessage()) ? task.getFailReason().getClass().getSimpleName() : task.getFailReason().getLocalizedMessage())));
|
||||
String msg = null;
|
||||
if (task.getFailReason() != null && !(task.getFailReason() instanceof NoShownTaskException))
|
||||
if (StrUtils.isBlank(task.getFailReason().getLocalizedMessage()))
|
||||
msg = task.getFailReason().getClass().getSimpleName();
|
||||
else
|
||||
msg = task.getFailReason().getLocalizedMessage();
|
||||
if (msg != null)
|
||||
failReasons.add(task.getInfo() + ": " + msg);
|
||||
pgsTotal.setMaximum(taskList.taskCount());
|
||||
pgsTotal.setValue(pgsTotal.getValue() + 1);
|
||||
int idx = tasks.indexOf(task);
|
||||
@@ -313,7 +322,8 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
boolean flag;
|
||||
|
||||
public TaskWindowFactory append(Task t) {
|
||||
ll.add(t);
|
||||
if (t != null)
|
||||
ll.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -118,8 +118,7 @@ public class FileDownloadTask extends Task implements PreviousResult<File>, Prev
|
||||
this.url = IOUtils.parseURL(p.getResult());
|
||||
|
||||
for (int repeat = 0; repeat < 6; repeat++) {
|
||||
if (repeat > 0) {
|
||||
HMCLog.warn("Failed to download, repeat: " + repeat);
|
||||
if (repeat > 0)
|
||||
if (failedCallbackReturnsNewURL != null) {
|
||||
URL tmp = IOUtils.parseURL(failedCallbackReturnsNewURL.apply(repeat));
|
||||
if (tmp != null) {
|
||||
@@ -127,7 +126,7 @@ public class FileDownloadTask extends Task implements PreviousResult<File>, Prev
|
||||
HMCLog.warn("Switch to: " + url);
|
||||
}
|
||||
}
|
||||
}
|
||||
HMCLog.log("Downloading: " + url + ", to: " + filePath);
|
||||
if (!shouldContinue)
|
||||
break;
|
||||
try {
|
||||
|
||||
@@ -285,7 +285,8 @@ advancedsettings.game_dir.default=默认(.minecraft/)
|
||||
advancedsettings.game_dir.independent=各版本独立(.minecraft/versions/<版本名>/,除assets,libraries)
|
||||
advancedsettings.no_jvm_args=不添加默认的JVM参数(使用Java9时必勾)
|
||||
advancedsettings.java_args_default=启动器默认添加的参数(请不要重复添加):-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -XX:MaxPermSize=???m -Xmx???m -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
|
||||
advancedsettings.wrapper_launcher=启动前执行命令(不必填写,将在游戏启动前调用)
|
||||
advancedsettings.wrapper_launcher=前置指令(不必填写,如optirun)
|
||||
advancedsettings.precall_command=启动前执行命令(不必填写,将在游戏启动前调用)
|
||||
advancedsettings.server_ip=直入服务器ip地址(不必填写,启动游戏后直接进入对应服务器)
|
||||
advancedsettings.cancel_wrapper_launcher=取消包裹启动器(出现奇怪问题时可尝试使用,与调试模式冲突)
|
||||
|
||||
@@ -296,7 +297,7 @@ mainwindow.enter_script_name=输入要生成脚本的文件名
|
||||
mainwindow.make_launch_succeed=启动脚本已生成完毕:
|
||||
mainwindow.no_version=未找到任何版本,是否进入游戏下载?
|
||||
|
||||
launcher.about=<html>默认背景图感谢gamerteam提供。<br/>关于作者:<br/>百度ID:huanghongxun20<br/>mcbbs:huanghongxun<br/>邮箱:huanghongxun2008@126.com<br/>Minecraft Forum ID: klkl6523<br/>欢迎提交Bug哦<br/>Copyright (c) 2013-2016 huangyuhui.<br/>免责声明:Minecraft软件版权归Mojang AB所有,使用本软件产生的版权问题本软件制作方概不负责。<br/>本启动器在GPLv3协议下开源:https://github.com/huanghongxun/HMCL/ ,感谢issues和pull requests贡献者<br/>本软件使用了基于Apache License 2.0的Gson项目,感谢贡献者。</html>
|
||||
launcher.about=<html>默认背景图感谢gamerteam提供。<br><a href="http://huangyuhui.duapp.com/link.php?type=sponsor">如果您希望本软件继续发展,请赞助</a><br/>关于作者:<br/>百度ID:huanghongxun20<br/>mcbbs:huanghongxun<br/>邮箱:huanghongxun2008@126.com<br/>Minecraft Forum ID: klkl6523<br/>欢迎提交Bug哦<br/>Copyright (c) 2013-2016 huangyuhui.<br/>免责声明:Minecraft软件版权归Mojang AB所有,使用本软件产生的版权问题本软件制作方概不负责。<br/>本启动器在GPLv3协议下开源:https://github.com/huanghongxun/HMCL/ ,感谢issues和pull requests贡献者<br/>本软件使用了基于Apache License 2.0的Gson项目,感谢贡献者。</html>
|
||||
launcher.download_source=下载源
|
||||
launcher.background_location=背景地址
|
||||
launcher.exit_failed=强制退出失败,可能是Forge 1.7.10及更高版本导致的,无法解决。
|
||||
@@ -310,7 +311,7 @@ launcher.enable_shadow=启用窗口阴影
|
||||
launcher.theme=主题
|
||||
launcher.proxy=代理
|
||||
launcher.decorated=启用窗口边框(Linux下可解决程序界面全灰问题)
|
||||
launcher.modpack=<html><a href="http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/">整合包作者帮助</a></html>
|
||||
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">整合包作者帮助</a></html>
|
||||
launcher.enable_animation=启用动态效果
|
||||
launcher.lang=语言
|
||||
launcher.restart=本界面选项需要重启本启动器生效
|
||||
|
||||
@@ -285,7 +285,8 @@ advancedsettings.game_dir.default=\u9ed8\u8ba4(.minecraft/)
|
||||
advancedsettings.game_dir.independent=\u5404\u7248\u672c\u72ec\u7acb(.minecraft/versions/<\u7248\u672c\u540d>/,\u9664assets,libraries)
|
||||
advancedsettings.no_jvm_args=\u4e0d\u6dfb\u52a0\u9ed8\u8ba4\u7684JVM\u53c2\u6570(\u4f7f\u7528Java9\u65f6\u5fc5\u52fe)
|
||||
advancedsettings.java_args_default=\u542f\u52a8\u5668\u9ed8\u8ba4\u6dfb\u52a0\u7684\u53c2\u6570\uff08\u8bf7\u4e0d\u8981\u91cd\u590d\u6dfb\u52a0\uff09\uff1a-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -XX:MaxPermSize=???m -Xmx???m -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
|
||||
advancedsettings.wrapper_launcher=\u542f\u52a8\u524d\u6267\u884c\u547d\u4ee4(\u4e0d\u5fc5\u586b\u5199\uff0c\u5c06\u5728\u6e38\u620f\u542f\u52a8\u524d\u8c03\u7528)
|
||||
advancedsettings.wrapper_launcher=\u524d\u7f6e\u6307\u4ee4(\u4e0d\u5fc5\u586b\u5199,\u5982optirun)
|
||||
advancedsettings.precall_command=\u542f\u52a8\u524d\u6267\u884c\u547d\u4ee4(\u4e0d\u5fc5\u586b\u5199\uff0c\u5c06\u5728\u6e38\u620f\u542f\u52a8\u524d\u8c03\u7528)
|
||||
advancedsettings.server_ip=\u76f4\u5165\u670d\u52a1\u5668ip\u5730\u5740(\u4e0d\u5fc5\u586b\u5199\uff0c\u542f\u52a8\u6e38\u620f\u540e\u76f4\u63a5\u8fdb\u5165\u5bf9\u5e94\u670d\u52a1\u5668)
|
||||
advancedsettings.cancel_wrapper_launcher=\u53d6\u6d88\u5305\u88f9\u542f\u52a8\u5668\uff08\u51fa\u73b0\u5947\u602a\u95ee\u9898\u65f6\u53ef\u5c1d\u8bd5\u4f7f\u7528,\u4e0e\u8c03\u8bd5\u6a21\u5f0f\u51b2\u7a81\uff09
|
||||
|
||||
@@ -296,7 +297,7 @@ mainwindow.enter_script_name=\u8f93\u5165\u8981\u751f\u6210\u811a\u672c\u7684\u6
|
||||
mainwindow.make_launch_succeed=\u542f\u52a8\u811a\u672c\u5df2\u751f\u6210\u5b8c\u6bd5:
|
||||
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u8fdb\u5165\u6e38\u620f\u4e0b\u8f7d\uff1f
|
||||
|
||||
launcher.about=<html>\u9ed8\u8ba4\u80cc\u666f\u56fe\u611f\u8c22gamerteam\u63d0\u4f9b\u3002<br/>\u5173\u4e8e\u4f5c\u8005\uff1a<br/>\u767e\u5ea6ID\uff1ahuanghongxun20<br/>mcbbs\uff1ahuanghongxun<br/>\u90ae\u7bb1\uff1ahuanghongxun2008@126.com<br/>Minecraft Forum ID: klkl6523<br/>\u6b22\u8fce\u63d0\u4ea4Bug\u54e6<br/>Copyright (c) 2013-2016 huangyuhui.<br/>\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u4f7f\u7528\u672c\u8f6f\u4ef6\u4ea7\u751f\u7684\u7248\u6743\u95ee\u9898\u672c\u8f6f\u4ef6\u5236\u4f5c\u65b9\u6982\u4e0d\u8d1f\u8d23\u3002<br/>\u672c\u542f\u52a8\u5668\u5728GPLv3\u534f\u8bae\u4e0b\u5f00\u6e90:https://github.com/huanghongxun/HMCL/ ,\u611f\u8c22issues\u548cpull requests\u8d21\u732e\u8005<br/>\u672c\u8f6f\u4ef6\u4f7f\u7528\u4e86\u57fa\u4e8eApache License 2.0\u7684Gson\u9879\u76ee\uff0c\u611f\u8c22\u8d21\u732e\u8005\u3002</html>
|
||||
launcher.about=<html>\u9ed8\u8ba4\u80cc\u666f\u56fe\u611f\u8c22gamerteam\u63d0\u4f9b\u3002<br><a href="http://huangyuhui.duapp.com/link.php?type=sponsor">\u5982\u679c\u60a8\u5e0c\u671b\u672c\u8f6f\u4ef6\u7ee7\u7eed\u53d1\u5c55\uff0c\u8bf7\u8d5e\u52a9</a><br/>\u5173\u4e8e\u4f5c\u8005\uff1a<br/>\u767e\u5ea6ID\uff1ahuanghongxun20<br/>mcbbs\uff1ahuanghongxun<br/>\u90ae\u7bb1\uff1ahuanghongxun2008@126.com<br/>Minecraft Forum ID: klkl6523<br/>\u6b22\u8fce\u63d0\u4ea4Bug\u54e6<br/>Copyright (c) 2013-2016 huangyuhui.<br/>\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u4f7f\u7528\u672c\u8f6f\u4ef6\u4ea7\u751f\u7684\u7248\u6743\u95ee\u9898\u672c\u8f6f\u4ef6\u5236\u4f5c\u65b9\u6982\u4e0d\u8d1f\u8d23\u3002<br/>\u672c\u542f\u52a8\u5668\u5728GPLv3\u534f\u8bae\u4e0b\u5f00\u6e90:https://github.com/huanghongxun/HMCL/ ,\u611f\u8c22issues\u548cpull requests\u8d21\u732e\u8005<br/>\u672c\u8f6f\u4ef6\u4f7f\u7528\u4e86\u57fa\u4e8eApache License 2.0\u7684Gson\u9879\u76ee\uff0c\u611f\u8c22\u8d21\u732e\u8005\u3002</html>
|
||||
launcher.download_source=\u4e0b\u8f7d\u6e90
|
||||
launcher.background_location=\u80cc\u666f\u5730\u5740
|
||||
launcher.exit_failed=\u5f3a\u5236\u9000\u51fa\u5931\u8d25\uff0c\u53ef\u80fd\u662fForge 1.7.10\u53ca\u66f4\u9ad8\u7248\u672c\u5bfc\u81f4\u7684\uff0c\u65e0\u6cd5\u89e3\u51b3\u3002
|
||||
@@ -310,7 +311,7 @@ launcher.enable_shadow=\u542f\u7528\u7a97\u53e3\u9634\u5f71
|
||||
launcher.theme=\u4e3b\u9898
|
||||
launcher.proxy=\u4ee3\u7406
|
||||
launcher.decorated=\u542f\u7528\u7a97\u53e3\u8fb9\u6846(Linux\u4e0b\u53ef\u89e3\u51b3\u7a0b\u5e8f\u754c\u9762\u5168\u7070\u95ee\u9898)
|
||||
launcher.modpack=<html><a href="http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/">\u6574\u5408\u5305\u4f5c\u8005\u5e2e\u52a9</a></html>
|
||||
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">\u6574\u5408\u5305\u4f5c\u8005\u5e2e\u52a9</a></html>
|
||||
launcher.enable_animation=\u542f\u7528\u52a8\u6001\u6548\u679c
|
||||
launcher.lang=\u8bed\u8a00
|
||||
launcher.restart=\u672c\u754c\u9762\u9009\u9879\u9700\u8981\u91cd\u542f\u672c\u542f\u52a8\u5668\u751f\u6548
|
||||
|
||||
@@ -286,6 +286,7 @@ advancedsettings.game_dir.independent=Independent (.minecraft/versions/<version
|
||||
advancedsettings.no_jvm_args=No Default JVM Args
|
||||
advancedsettings.java_args_default=Default java args: -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -XX:MaxPermSize=???m -Xmx???m -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
|
||||
advancedsettings.wrapper_launcher=Wrapper Launcher(like optirun...)
|
||||
advancedsettings.precall_command=Precalling command(will be executed before game launching)
|
||||
advancedsettings.server_ip=Server Host
|
||||
advancedsettings.cancel_wrapper_launcher=Cancel Wrapper Launcher
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ advancedsettings.game_dir.independent=Independent (.minecraft/versions/<version
|
||||
advancedsettings.no_jvm_args=No Default JVM Args
|
||||
advancedsettings.java_args_default=Default java args: -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -XX:MaxPermSize=???m -Xmx???m -Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
|
||||
advancedsettings.wrapper_launcher=Wrapper Launcher(like optirun...)
|
||||
advancedsettings.precall_command=Precalling command(will be executed before game launching)
|
||||
advancedsettings.server_ip=Server Host
|
||||
advancedsettings.cancel_wrapper_launcher=Cancel Wrapper Launcher
|
||||
|
||||
|
||||
@@ -285,7 +285,8 @@ advancedsettings.game_dir.default=默認(.minecraft/)
|
||||
advancedsettings.game_dir.independent=各版本獨立(.minecraft/versions/<版本名>/,除assets,libraries)
|
||||
advancedsettings.no_jvm_args=不添加默認的JVM參數(使用Java9時必勾)
|
||||
advancedsettings.java_args_default=啟動器默認添加的參數(請不要重複添加):-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -XX:MaxPermSize=???m -Xmx???m -Dfml. ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
|
||||
advancedsettings.wrapper_launcher=前置啟動指令(不必填寫,內容將加在啟動腳本最前,如optirun...)
|
||||
advancedsettings.wrapper_launcher=前置指令(不必填寫,如optirun)
|
||||
advancedsettings.precall_command=啟動前執行命令(不必填寫,將在遊戲啟動前調用)
|
||||
advancedsettings.server_ip=直入伺服器ip地址(不必填寫,啟動遊戲後直接進入對應伺服器)
|
||||
advancedsettings.cancel_wrapper_launcher=取消包裹啟動器(出現奇怪問題時可嘗試使用,與調試模式衝突)
|
||||
|
||||
@@ -296,7 +297,7 @@ mainwindow.enter_script_name=輸入要生成腳本的資料名
|
||||
mainwindow.make_launch_succeed=啟動腳本已生成完畢:
|
||||
mainwindow.no_version=未找到任何版本,是否進入遊戲下載?
|
||||
|
||||
launcher.about=<html>默認背景圖感謝gamerteam提供。 <br/>關於作者:<br/>百度ID:huanghongxun20<br/>mcbbs:huanghongxun<br/>郵箱:huanghongxun2008@126.com<br/>Minecraft Forum ID: klkl6523<br />歡迎提交Bug哦<br/>Copyright (c) 2013-2016 huangyuhui.<br/>免責聲明:Minecraft軟體版權歸Mojang AB所有,遊戲由於誤操作本啟動器而丟失數據的概不負責。 <br/>本啟動器在GPLv3協議下開源:http://github.com/huanghongxun/HMCL/ ,感谢issues和pull requests贡献者<br/>本軟體使用了基於Apache License 2.0的Gson項目,感謝貢獻者。</html>
|
||||
launcher.about=<html>默認背景圖感謝gamerteam提供。<br><a href="http://huangyuhui.duapp.com/link.php?type=sponsor">如果您希望本軟件繼續發展,請贊助</a><br>關於作者:<br>百度ID:huanghongxun20<br>mcbbs:huanghongxun<br>郵箱:huanghongxun2008@126.com<br>Minecraft Forum ID: klkl6523<br>歡迎提交Bug哦<br/>Copyright (c) 2013-2016 huangyuhui.<br>免責聲明:Minecraft軟體版權歸Mojang AB所有,遊戲由於誤操作本啟動器而丟失數據的概不負責。<br>本啟動器在GPLv3協議下開源:http://github.com/huanghongxun/HMCL/ ,感谢issues和pull requests贡献者<br>本軟體使用了基於Apache License 2.0的Gson項目,感謝貢獻者。</html>
|
||||
launcher.download_source=下載源
|
||||
launcher.background_location=背景地址
|
||||
launcher.exit_failed=強制退出失敗,可能是Forge 1.7.10及更高版本導致的,無法解決。
|
||||
@@ -310,7 +311,7 @@ launcher.enable_shadow=启用窗口阴影
|
||||
launcher.theme=主题
|
||||
launcher.proxy=代理
|
||||
launcher.decorated=啟用窗口邊框(Linux下可解決程序界面全灰問題)
|
||||
launcher.modpack=<html><a href="http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/">整合包作者帮助</a></html>
|
||||
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">整合包作者帮助</a></html>
|
||||
launcher.enable_animation=啟用動態效果
|
||||
launcher.lang=語言
|
||||
launcher.restart=本界面選項需要重啟本啟動器生效
|
||||
|
||||
@@ -285,7 +285,8 @@ advancedsettings.game_dir.default=\u9ed8\u8a8d(.minecraft/)
|
||||
advancedsettings.game_dir.independent=\u5404\u7248\u672c\u7368\u7acb(.minecraft/versions/<\u7248\u672c\u540d>/,\u9664assets,libraries)
|
||||
advancedsettings.no_jvm_args=\u4e0d\u6dfb\u52a0\u9ed8\u8a8d\u7684JVM\u53c3\u6578(\u4f7f\u7528Java9\u6642\u5fc5\u52fe)
|
||||
advancedsettings.java_args_default=\u555f\u52d5\u5668\u9ed8\u8a8d\u6dfb\u52a0\u7684\u53c3\u6578\uff08\u8acb\u4e0d\u8981\u91cd\u8907\u6dfb\u52a0\uff09\uff1a-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -XX:MaxPermSize=???m -Xmx???m -Dfml. ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true
|
||||
advancedsettings.wrapper_launcher=\u524d\u7f6e\u555f\u52d5\u6307\u4ee4(\u4e0d\u5fc5\u586b\u5beb\uff0c\u5167\u5bb9\u5c07\u52a0\u5728\u555f\u52d5\u8173\u672c\u6700\u524d\uff0c\u5982optirun...)
|
||||
advancedsettings.wrapper_launcher=\u524d\u7f6e\u6307\u4ee4(\u4e0d\u5fc5\u586b\u5beb,\u5982optirun)
|
||||
advancedsettings.precall_command=\u555f\u52d5\u524d\u57f7\u884c\u547d\u4ee4(\u4e0d\u5fc5\u586b\u5beb,\u5c07\u5728\u904a\u6232\u555f\u52d5\u524d\u8abf\u7528)
|
||||
advancedsettings.server_ip=\u76f4\u5165\u4f3a\u670d\u5668ip\u5730\u5740(\u4e0d\u5fc5\u586b\u5beb\uff0c\u555f\u52d5\u904a\u6232\u5f8c\u76f4\u63a5\u9032\u5165\u5c0d\u61c9\u4f3a\u670d\u5668)
|
||||
advancedsettings.cancel_wrapper_launcher=\u53d6\u6d88\u5305\u88f9\u555f\u52d5\u5668(\u51fa\u73fe\u5947\u602a\u554f\u984c\u6642\u53ef\u5617\u8a66\u4f7f\u7528,\u8207\u8abf\u8a66\u6a21\u5f0f\u885d\u7a81)
|
||||
|
||||
@@ -296,7 +297,7 @@ mainwindow.enter_script_name=\u8f38\u5165\u8981\u751f\u6210\u8173\u672c\u7684\u8
|
||||
mainwindow.make_launch_succeed=\u555f\u52d5\u8173\u672c\u5df2\u751f\u6210\u5b8c\u7562:
|
||||
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u9032\u5165\u904a\u6232\u4e0b\u8f09\uff1f
|
||||
|
||||
launcher.about=<html>\u9ed8\u8a8d\u80cc\u666f\u5716\u611f\u8b1dgamerteam\u63d0\u4f9b\u3002 <br/>\u95dc\u65bc\u4f5c\u8005\uff1a<br/>\u767e\u5ea6ID\uff1ahuanghongxun20<br/>mcbbs\uff1ahuanghongxun<br/>\u90f5\u7bb1\uff1ahuanghongxun2008@126.com<br/>Minecraft Forum ID: klkl6523<br />\u6b61\u8fce\u63d0\u4ea4Bug\u54e6<br/>Copyright (c) 2013-2016 huangyuhui.<br/>\u514d\u8cac\u8072\u660e\uff1aMinecraft\u8edf\u9ad4\u7248\u6b0a\u6b78Mojang AB\u6240\u6709\uff0c\u904a\u6232\u7531\u65bc\u8aa4\u64cd\u4f5c\u672c\u555f\u52d5\u5668\u800c\u4e1f\u5931\u6578\u64da\u7684\u6982\u4e0d\u8ca0\u8cac\u3002 <br/>\u672c\u555f\u52d5\u5668\u5728GPLv3\u5354\u8b70\u4e0b\u958b\u6e90:http://github.com/huanghongxun/HMCL/ ,\u611f\u8c22issues\u548cpull requests\u8d21\u732e\u8005<br/>\u672c\u8edf\u9ad4\u4f7f\u7528\u4e86\u57fa\u65bcApache License 2.0\u7684Gson\u9805\u76ee\uff0c\u611f\u8b1d\u8ca2\u737b\u8005\u3002</html>
|
||||
launcher.about=<html>\u9ed8\u8a8d\u80cc\u666f\u5716\u611f\u8b1dgamerteam\u63d0\u4f9b\u3002<br><a href="http://huangyuhui.duapp.com/link.php?type=sponsor">\u5982\u679c\u60a8\u5e0c\u671b\u672c\u8edf\u4ef6\u7e7c\u7e8c\u767c\u5c55\uff0c\u8acb\u8d0a\u52a9</a><br>\u95dc\u65bc\u4f5c\u8005\uff1a<br>\u767e\u5ea6ID\uff1ahuanghongxun20<br>mcbbs\uff1ahuanghongxun<br>\u90f5\u7bb1\uff1ahuanghongxun2008@126.com<br>Minecraft Forum ID: klkl6523<br>\u6b61\u8fce\u63d0\u4ea4Bug\u54e6<br/>Copyright (c) 2013-2016 huangyuhui.<br>\u514d\u8cac\u8072\u660e\uff1aMinecraft\u8edf\u9ad4\u7248\u6b0a\u6b78Mojang AB\u6240\u6709\uff0c\u904a\u6232\u7531\u65bc\u8aa4\u64cd\u4f5c\u672c\u555f\u52d5\u5668\u800c\u4e1f\u5931\u6578\u64da\u7684\u6982\u4e0d\u8ca0\u8cac\u3002<br>\u672c\u555f\u52d5\u5668\u5728GPLv3\u5354\u8b70\u4e0b\u958b\u6e90:http://github.com/huanghongxun/HMCL/ ,\u611f\u8c22issues\u548cpull requests\u8d21\u732e\u8005<br>\u672c\u8edf\u9ad4\u4f7f\u7528\u4e86\u57fa\u65bcApache License 2.0\u7684Gson\u9805\u76ee\uff0c\u611f\u8b1d\u8ca2\u737b\u8005\u3002</html>
|
||||
launcher.download_source=\u4e0b\u8f09\u6e90
|
||||
launcher.background_location=\u80cc\u666f\u5730\u5740
|
||||
launcher.exit_failed=\u5f37\u5236\u9000\u51fa\u5931\u6557\uff0c\u53ef\u80fd\u662fForge 1.7.10\u53ca\u66f4\u9ad8\u7248\u672c\u5c0e\u81f4\u7684\uff0c\u7121\u6cd5\u89e3\u6c7a\u3002
|
||||
@@ -310,7 +311,7 @@ launcher.enable_shadow=\u542f\u7528\u7a97\u53e3\u9634\u5f71
|
||||
launcher.theme=\u4e3b\u9898
|
||||
launcher.proxy=\u4ee3\u7406
|
||||
launcher.decorated=\u555f\u7528\u7a97\u53e3\u908a\u6846(Linux\u4e0b\u53ef\u89e3\u6c7a\u7a0b\u5e8f\u754c\u9762\u5168\u7070\u554f\u984c)
|
||||
launcher.modpack=<html><a href="http://blog.163.com/huanghongxun2008@126/blog/static/7738046920160323812771/">\u6574\u5408\u5305\u4f5c\u8005\u5e2e\u52a9</a></html>
|
||||
launcher.modpack=<html><a href="http://huangyuhui.duapp.com/link.php?type=modpack">\u6574\u5408\u5305\u4f5c\u8005\u5e2e\u52a9</a></html>
|
||||
launcher.enable_animation=\u555f\u7528\u52d5\u614b\u6548\u679c
|
||||
launcher.lang=\u8a9e\u8a00
|
||||
launcher.restart=\u672c\u754c\u9762\u9078\u9805\u9700\u8981\u91cd\u555f\u672c\u555f\u52d5\u5668\u751f\u6548
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ if (buildnumber == null)
|
||||
|
||||
def versionroot = System.getenv("VERSION_ROOT")
|
||||
if (versionroot == null)
|
||||
versionroot = "0.8.6"
|
||||
versionroot = "0.8.7"
|
||||
|
||||
String mavenGroupId = 'HMCSM'
|
||||
String mavenVersion = versionroot + '.' + buildnumber
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Main {
|
||||
|
||||
public static String launcherName = "Hello Minecraft! Server Manager";
|
||||
public static final String PUBLISH_URL = "http://www.mcbbs.net/thread-171239-1-1.html";
|
||||
public static final byte VERSION_FIRST = 0, VERSION_SECOND = 8, VERSION_THIRD = 6;
|
||||
public static final byte VERSION_FIRST = 0, VERSION_SECOND = 8, VERSION_THIRD = 7;
|
||||
public static final UpdateChecker UPDATE_CHECKER = new UpdateChecker(new VersionNumber(VERSION_FIRST, VERSION_SECOND, VERSION_THIRD), "hmcsm");
|
||||
|
||||
public static String makeTitle() {
|
||||
|
||||
@@ -209,14 +209,23 @@ public final class MainWindow extends javax.swing.JFrame
|
||||
//<editor-fold defaultstate="collapsed" desc="基本信息菜单">
|
||||
class ActionListenerImpl implements ActionListener {
|
||||
|
||||
String s;
|
||||
String s, q;
|
||||
|
||||
public ActionListenerImpl(String s) {
|
||||
this(s, null);
|
||||
}
|
||||
|
||||
public ActionListenerImpl(String s, String question) {
|
||||
this.s = s;
|
||||
q = question;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
String ans = q == null ? "" : JOptionPane.showInputDialog(q);
|
||||
if (ans == null)
|
||||
return;
|
||||
s = s.replace("{}", ans);
|
||||
Server.getInstance().sendCommand(s);
|
||||
}
|
||||
|
||||
@@ -233,9 +242,9 @@ public final class MainWindow extends javax.swing.JFrame
|
||||
itm.addActionListener(new ActionListenerImpl("time set 0"));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("广播");
|
||||
itm.addActionListener(new ActionListenerImpl("say " + JOptionPane.showInputDialog("广播讯息")));
|
||||
itm.addActionListener(new ActionListenerImpl("say {}", JOptionPane.showInputDialog("广播讯息")));
|
||||
itm = new JMenuItem("红字广播");
|
||||
itm.addActionListener(new ActionListenerImpl("me " + JOptionPane.showInputDialog("广播讯息")));
|
||||
itm.addActionListener(new ActionListenerImpl("me {}", JOptionPane.showInputDialog("广播讯息")));
|
||||
itm = new JMenuItem("私聊");
|
||||
itm.addActionListener(e -> {
|
||||
InputDialog id = new InputDialog(MainWindow.this, true, new String[] { "玩家", "讯息" });
|
||||
@@ -244,16 +253,16 @@ public final class MainWindow extends javax.swing.JFrame
|
||||
});
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("给予OP");
|
||||
itm.addActionListener(new ActionListenerImpl("op " + JOptionPane.showInputDialog("新OP的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("op {}", JOptionPane.showInputDialog("新OP的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("卸除OP");
|
||||
itm.addActionListener(new ActionListenerImpl("deop " + JOptionPane.showInputDialog("要卸除OP的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("deop {}", JOptionPane.showInputDialog("要卸除OP的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("给予玩家白名单");
|
||||
itm.addActionListener(new ActionListenerImpl("whitelist add " + JOptionPane.showInputDialog("要添入白名单的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("whitelist add {}", JOptionPane.showInputDialog("要添入白名单的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("解除玩家白名单");
|
||||
itm.addActionListener(new ActionListenerImpl("whitelist remove " + JOptionPane.showInputDialog("要解除白名单的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("whitelist remove {}", JOptionPane.showInputDialog("要解除白名单的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("启用白名单");
|
||||
itm.addActionListener(new ActionListenerImpl("whitelist on"));
|
||||
@@ -265,31 +274,31 @@ public final class MainWindow extends javax.swing.JFrame
|
||||
itm.addActionListener(new ActionListenerImpl("whitelist list"));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("封禁玩家");
|
||||
itm.addActionListener(new ActionListenerImpl("ban " + JOptionPane.showInputDialog("要封禁玩家的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("ban {}", JOptionPane.showInputDialog("要封禁玩家的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("封禁玩家IP");
|
||||
itm.addActionListener(new ActionListenerImpl("ban-ip " + JOptionPane.showInputDialog("要封禁玩家IP的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("ban-ip {}", JOptionPane.showInputDialog("要封禁玩家IP的游戏名")));
|
||||
itm = new JMenuItem("解封玩家");
|
||||
itm.addActionListener(new ActionListenerImpl("pardon " + JOptionPane.showInputDialog("要解封玩家的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("pardon {}", JOptionPane.showInputDialog("要解封玩家的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("解封玩家IP");
|
||||
itm.addActionListener(new ActionListenerImpl("pardon-ip " + JOptionPane.showInputDialog("要解封玩家IP的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("pardon-ip {}", JOptionPane.showInputDialog("要解封玩家IP的游戏名")));
|
||||
itm = new JMenuItem("封禁玩家");
|
||||
itm.addActionListener(new ActionListenerImpl("ban " + JOptionPane.showInputDialog("要封禁玩家的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("ban {}", JOptionPane.showInputDialog("要封禁玩家的游戏名")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("封禁玩家IP");
|
||||
itm.addActionListener(new ActionListenerImpl("ban-ip " + JOptionPane.showInputDialog("要封禁玩家IP的游戏名")));
|
||||
itm.addActionListener(new ActionListenerImpl("ban-ip {}", JOptionPane.showInputDialog("要封禁玩家IP的游戏名")));
|
||||
itm = new JMenuItem("封禁玩家列表");
|
||||
itm.addActionListener(new ActionListenerImpl("banlist"));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("修改时间");
|
||||
itm.addActionListener(new ActionListenerImpl("time set " + JOptionPane.showInputDialog("要调整的时间值")));
|
||||
itm.addActionListener(new ActionListenerImpl("time set {}", JOptionPane.showInputDialog("要调整的时间值")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("往后调整时间");
|
||||
itm.addActionListener(new ActionListenerImpl("time add " + JOptionPane.showInputDialog("要往后调整的时间值")));
|
||||
itm.addActionListener(new ActionListenerImpl("time add {}", JOptionPane.showInputDialog("要往后调整的时间值")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("调整天气");
|
||||
itm.addActionListener(new ActionListenerImpl("weather " + JOptionPane.showInputDialog("要调整的天气(只能填:clear[意思是取消所有天气]或rain[意思是下雨]或thunder[意思是打雷]")));
|
||||
itm.addActionListener(new ActionListenerImpl("weather {}", JOptionPane.showInputDialog("要调整的天气(只能填:clear[意思是取消所有天气]或rain[意思是下雨]或thunder[意思是打雷]")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("调整一定时间的天气");
|
||||
itm.addActionListener(e -> {
|
||||
@@ -305,10 +314,10 @@ public final class MainWindow extends javax.swing.JFrame
|
||||
});
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("清除背包");
|
||||
itm.addActionListener(new ActionListenerImpl("clear" + JOptionPane.showInputDialog("要被清除背包的玩家")));
|
||||
itm.addActionListener(new ActionListenerImpl("clear {}", JOptionPane.showInputDialog("要被清除背包的玩家")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("踢出玩家");
|
||||
itm.addActionListener(new ActionListenerImpl("kick " + JOptionPane.showInputDialog("要被踢出的玩家")));
|
||||
itm.addActionListener(new ActionListenerImpl("kick {}", JOptionPane.showInputDialog("要被踢出的玩家")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("在线玩家");
|
||||
itm.addActionListener(new ActionListenerImpl("list"));
|
||||
@@ -334,10 +343,10 @@ public final class MainWindow extends javax.swing.JFrame
|
||||
itm.addActionListener(new ActionListenerImpl("save-off"));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("难度");
|
||||
itm.addActionListener(new ActionListenerImpl("difficulty " + JOptionPane.showInputDialog("难度")));
|
||||
itm.addActionListener(new ActionListenerImpl("difficulty {}", JOptionPane.showInputDialog("难度")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("默认游戏模式");
|
||||
itm.addActionListener(new ActionListenerImpl("defaultgamemode " + JOptionPane.showInputDialog("默认游戏模式")));
|
||||
itm.addActionListener(new ActionListenerImpl("defaultgamemode {}", JOptionPane.showInputDialog("默认游戏模式")));
|
||||
ppmBasically.add(itm);
|
||||
itm = new JMenuItem("地图种子");
|
||||
itm.addActionListener(new ActionListenerImpl("seed"));
|
||||
|
||||
Reference in new issue
Block a user