Fixed many bugs
This commit is contained in:
@@ -29,7 +29,19 @@ public final class C {
|
||||
public static final Gson gsonPrettyPrinting = new GsonBuilder().setPrettyPrinting().create();
|
||||
public static final Gson gson = new Gson();
|
||||
|
||||
public static final ResourceBundle I18N = ResourceBundle.getBundle("org/jackhuang/hellominecraft/launcher/I18N");
|
||||
public static final ResourceBundle I18N;
|
||||
|
||||
static {
|
||||
ResourceBundle rb = null;
|
||||
try {
|
||||
rb = ResourceBundle.getBundle("org/jackhuang/hellominecraft/launcher/I18N");
|
||||
} catch(Throwable t) {
|
||||
rb = null;
|
||||
System.out.println("Did you delete I18N.properties?");
|
||||
t.printStackTrace();
|
||||
}
|
||||
I18N = rb;
|
||||
}
|
||||
|
||||
//http://repo1.maven.org/maven2
|
||||
public static final String URL_PUBLISH = "http://www.mcbbs.net/thread-142335-1-1.html";
|
||||
|
||||
@@ -71,16 +71,15 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
return this;
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
public synchronized void clean() {
|
||||
if (isVisible()) return;
|
||||
taskList = null;
|
||||
taskList = new TaskList();
|
||||
taskList.addTaskListener(this);
|
||||
taskList.addAllDoneListener(this);
|
||||
}
|
||||
|
||||
public boolean start() {
|
||||
if (isVisible() || taskList.isAlive()) return false;
|
||||
if (isVisible() || taskList == null || taskList.isAlive()) return false;
|
||||
pgsTotal.setValue(0);
|
||||
suc = false;
|
||||
SwingUtils.clearDefaultTable(lstDownload);
|
||||
@@ -179,7 +178,8 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
}
|
||||
|
||||
if (!suc) {
|
||||
SwingUtilities.invokeLater(taskList::abort);
|
||||
if (taskList != null)
|
||||
SwingUtilities.invokeLater(taskList::abort);
|
||||
HMCLog.log("Tasks have been canceled by user.");
|
||||
}
|
||||
taskList = null;
|
||||
@@ -205,7 +205,7 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
int idx = tasks.indexOf(task);
|
||||
if (idx == -1) return;
|
||||
int pgs = progress * 100 / max;
|
||||
if (progresses.get(idx) != pgs) {
|
||||
if (progresses.contains(idx) && progresses.get(idx) != pgs && lstDownload.getRowCount() > idx) {
|
||||
SwingUtils.setValueAt(lstDownload, pgs + "%", idx, 1);
|
||||
progresses.set(idx, pgs);
|
||||
}
|
||||
@@ -281,8 +281,6 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
}
|
||||
|
||||
public static class TaskWindowFactory {
|
||||
public static final Object obj = new Object();
|
||||
|
||||
LinkedList<Task> ll = new LinkedList<>();
|
||||
|
||||
public TaskWindowFactory addTask(Task t) {
|
||||
@@ -291,7 +289,8 @@ public class TaskWindow extends javax.swing.JDialog
|
||||
}
|
||||
|
||||
public boolean start() {
|
||||
synchronized(obj) {
|
||||
synchronized(instance) {
|
||||
if (instance.isVisible()) return false;
|
||||
TaskWindow tw = inst();
|
||||
for(Task t : ll) tw.addTask(t);
|
||||
return tw.start();
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URLDecoder;
|
||||
@@ -93,7 +92,7 @@ public final class Utils {
|
||||
try {
|
||||
Desktop.getDesktop().browse(new URI(url));
|
||||
return true;
|
||||
} catch (URISyntaxException | IOException ex) {
|
||||
} catch (Exception ex) {
|
||||
HMCLog.warn("Failed to open link:" + url, ex);
|
||||
return false;
|
||||
}
|
||||
@@ -166,7 +165,8 @@ public final class Utils {
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to fight against the permission manager.
|
||||
* In order to fight against the permission manager by Minecraft Forge.
|
||||
* @param status exit code
|
||||
*/
|
||||
public static void shutdownForcely(int status) {
|
||||
try {
|
||||
|
||||
@@ -435,6 +435,7 @@ public class FileUtils {
|
||||
public static File[] searchSuffix(File dir, String suffix) {
|
||||
ArrayList<File> al = new ArrayList();
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) return new File[0];
|
||||
for (File f : files)
|
||||
if (f.getName().endsWith(suffix)) al.add(f);
|
||||
return al.toArray(new File[0]);
|
||||
|
||||
@@ -57,12 +57,14 @@ public final class JdkVersion {
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof JdkVersion)) return false;
|
||||
JdkVersion b = (JdkVersion) obj;
|
||||
if(b.location == null || location == null)
|
||||
return b.location == location;
|
||||
return new File(b.location).equals(new File(location));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return new File(location).hashCode();
|
||||
return location == null ? 0 : new File(location).hashCode();
|
||||
}
|
||||
|
||||
public JdkVersion(String location) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.C;
|
||||
*/
|
||||
public class MessageBox {
|
||||
|
||||
private static String Title = C.i18n("message.info");
|
||||
private static final String TITLE = C.i18n("message.info");
|
||||
/**
|
||||
* Buttons: OK
|
||||
*/
|
||||
@@ -110,7 +110,7 @@ public class MessageBox {
|
||||
* @return User Operation
|
||||
*/
|
||||
public static int Show(String Msg, int Option) {
|
||||
return Show(Msg, Title, Option);
|
||||
return Show(Msg, TITLE, Option);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,6 +120,6 @@ public class MessageBox {
|
||||
* @return User Operation
|
||||
*/
|
||||
public static int Show(String Msg) {
|
||||
return Show(Msg, Title, INFORMATION_MESSAGE);
|
||||
return Show(Msg, TITLE, INFORMATION_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ settings.failed_load=\u8bbe\u7f6e\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25\uff0c\u53e
|
||||
mods=Mod\u7ba1\u7406
|
||||
mods.choose_mod=\u9009\u62e9\u6a21\u7ec4
|
||||
mods.failed=\u6dfb\u52a0\u5931\u8d25
|
||||
mods.default_information=<html><font color=#c0392b>\u60a8\u53ef\u4ee5\u4ece\u8d44\u6e90\u7ba1\u7406\u5668\u62d6\u52a8mod\u6587\u4ef6\u5230\u5217\u8868\u4e2d\u6765\u6dfb\u52a0mod\uff0c\u540c\u65f6\u4f7f\u7528\u5220\u9664\u952e\u53ef\u5feb\u901f\u5220\u9664\u9009\u4e2dmod<br>\u70b9\u6389mod\u524d\u9762\u7684\u52fe\u53ef\u7981\u7528mod\uff0c\u4e0d\u4f1a\u52a0\u8f7d\uff1b\u9009\u62e9mod\u53ef\u4ee5\u83b7\u53d6mod\u4fe1\u606f</font></html>
|
||||
mods.default_information=<html><font color=#c0392b>\u5b89\u88c5Mod\u524d\u4f60\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Forge\u6216LiteLoader!<br>\u60a8\u53ef\u4ee5\u4ece\u8d44\u6e90\u7ba1\u7406\u5668\u62d6\u52a8mod\u6587\u4ef6\u5230\u5217\u8868\u4e2d\u6765\u6dfb\u52a0mod\uff0c\u540c\u65f6\u4f7f\u7528\u5220\u9664\u952e\u53ef\u5feb\u901f\u5220\u9664\u9009\u4e2dmod<br>\u70b9\u6389mod\u524d\u9762\u7684\u52fe\u53ef\u7981\u7528mod\uff0c\u4e0d\u4f1a\u52a0\u8f7d\uff1b\u9009\u62e9mod\u53ef\u4ee5\u83b7\u53d6mod\u4fe1\u606f</font></html>
|
||||
|
||||
advancedsettings=\u9ad8\u7ea7\u8bbe\u7f6e
|
||||
advancedsettings.launcher_visible=\u542f\u52a8\u5668\u53ef\u89c1\u6027
|
||||
@@ -227,6 +227,7 @@ advancedsettings.no_jvm_args=\u4e0d\u6dfb\u52a0JVM\u53c2\u6570(\u4f7f\u7528Java9
|
||||
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.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
|
||||
|
||||
mainwindow.show_log=\u67e5\u770b\u65e5\u5fd7
|
||||
mainwindow.make_launch_script=\u751f\u6210\u542f\u52a8\u811a\u672c
|
||||
@@ -293,6 +294,7 @@ setupwindow.find_in_configurations=\u5bfc\u5165\u5b8c\u6210\uff0c\u5feb\u5230\u9
|
||||
setupwindow.give_a_name=\u7ed9\u65b0\u6e38\u620f\u8def\u5f84\u8d77\u4e2a\u540d\u5b57\u5427
|
||||
setupwindow.new=\u65b0\u5efa
|
||||
setupwindow.no_empty_name=\u540d\u5b57\u4e0d\u53ef\u4e3a\u7a7a
|
||||
setupwindow.clean=\u6e05\u7406\u6e38\u620f\u6587\u4ef6
|
||||
|
||||
update.no_browser=\u65e0\u6cd5\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u7f51\u5740\u5df2\u7ecf\u590d\u5236\u5230\u526a\u8d34\u677f\u4e86\uff0c\u60a8\u53ef\u4ee5\u624b\u52a8\u7c98\u8d34\u7f51\u5740\u6253\u5f00\u9875\u9762
|
||||
update.should_open_link=\u662f\u5426\u524d\u5f80\u53d1\u5e03\u9875\u9762\u66f4\u65b0\uff1f
|
||||
|
||||
@@ -134,7 +134,7 @@ ui.button.run=Play
|
||||
ui.button.settings=Settings
|
||||
ui.button.about=About
|
||||
ui.button.others=Others
|
||||
ui.button.logout=LogOut
|
||||
ui.button.logout=Log Out
|
||||
ui.button.download=Download
|
||||
ui.button.retry=Retry
|
||||
ui.button.delete=Delete
|
||||
@@ -209,6 +209,7 @@ settings.failed_load=Failed to load settings file. Remove it?
|
||||
mods=Mods
|
||||
mods.choose_mod=Choose your mods
|
||||
mods.failed=Failed to add mods
|
||||
mods.default_information=<html><font color=#c0392b>Please ensure that you have installed Forge or LiteLoader before installing mods!<br>You can drop your mod files from explorer/finder, and delete mods by the delete button.<br>Disable a mod by leaving the check box unchecked; Choose an item to get the information.</font></html>
|
||||
|
||||
advancedsettings=Advanced
|
||||
advancedsettings.launcher_visible=Launcher Visibility
|
||||
@@ -226,6 +227,7 @@ advancedsettings.no_jvm_args=No 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.server_ip=Server Host
|
||||
advancedsettings.cancel_wrapper_launcher=Cancel Wrapper Launcher
|
||||
|
||||
mainwindow.show_log=Show Logs
|
||||
mainwindow.make_launch_script=Make Launching Script.
|
||||
@@ -240,11 +242,13 @@ launcher.background_location=Background Location
|
||||
launcher.exit_failed=Failed to shutdown.
|
||||
launcher.versions_json_not_matched=The version %s is malformed! There are a json:%s in this version. Do you want to fix this problem?
|
||||
launcher.versions_json_not_matched_cannot_auto_completion=The version %s lost version information file, delete it?
|
||||
launcher.versions_json_not_formatted=The version information of %s is malformed! Redownload it?
|
||||
launcher.choose_bgpath=Choose background path.
|
||||
launcher.background_tooltip=<html>\n<body>\nThis app uses the default background at first.<br />\nIf there is background.png in the directory, it will be used.<br />\nIf there is "bg" subdirectory, this app will chooses one picture in "bgskin" randomly.<br />\nIf you set the background setting, this app will use it.\n</body>\n</html>
|
||||
launcher.update_launcher=Check for update
|
||||
launcher.enable_shadow=Enable Window Shadow
|
||||
launcher.theme=Theme
|
||||
launcher.proxy=Proxy
|
||||
|
||||
launcher.title.game=Games
|
||||
launcher.title.main=Home
|
||||
@@ -269,6 +273,7 @@ assets.not_refreshed=The assets list is not refreshed, please refresh it once.
|
||||
assets.failed=Failed to get the list, try again.
|
||||
assets.list.1_7_3_after=1.7.3 And Higher
|
||||
assets.list.1_6=1.6(BMCLAPI)
|
||||
assets.unkown_type_select_one=Unknown game version: %s, please choose an asset type.
|
||||
assets.type=Asset Type
|
||||
assets.download=Download Assets
|
||||
assets.no_assets=Assets are not complete, complete them?
|
||||
@@ -289,6 +294,7 @@ setupwindow.find_in_configurations=Finished importing. You can find it in the co
|
||||
setupwindow.give_a_name=Give a name to the new game.
|
||||
setupwindow.new=New
|
||||
setupwindow.no_empty_name=Version name cannot be empty.
|
||||
setupwindow.clean=Clean game files
|
||||
|
||||
update.no_browser=Cannot open any browser. The link has been copied to the clipboard. You can paste it to the address bar.
|
||||
update.should_open_link=Are you willing to open the update link?
|
||||
|
||||
@@ -209,7 +209,7 @@ settings.failed_load=\u8bbe\u7f6e\u6587\u4ef6\u52a0\u8f7d\u5931\u8d25\uff0c\u53e
|
||||
mods=Mod\u7ba1\u7406
|
||||
mods.choose_mod=\u9009\u62e9\u6a21\u7ec4
|
||||
mods.failed=\u6dfb\u52a0\u5931\u8d25
|
||||
mods.default_information=<html><font color=#c0392b>\u60a8\u53ef\u4ee5\u4ece\u8d44\u6e90\u7ba1\u7406\u5668\u62d6\u52a8mod\u6587\u4ef6\u5230\u5217\u8868\u4e2d\u6765\u6dfb\u52a0mod\uff0c\u540c\u65f6\u4f7f\u7528\u5220\u9664\u952e\u53ef\u5feb\u901f\u5220\u9664\u9009\u4e2dmod<br>\u70b9\u6389mod\u524d\u9762\u7684\u52fe\u53ef\u7981\u7528mod\uff0c\u4e0d\u4f1a\u52a0\u8f7d\uff1b\u9009\u62e9mod\u53ef\u4ee5\u83b7\u53d6mod\u4fe1\u606f</font></html>
|
||||
mods.default_information=<html><font color=#c0392b>\u5b89\u88c5Mod\u524d\u4f60\u9700\u8981\u786e\u4fdd\u5df2\u5b89\u88c5Forge\u6216LiteLoader!<br>\u60a8\u53ef\u4ee5\u4ece\u8d44\u6e90\u7ba1\u7406\u5668\u62d6\u52a8mod\u6587\u4ef6\u5230\u5217\u8868\u4e2d\u6765\u6dfb\u52a0mod\uff0c\u540c\u65f6\u4f7f\u7528\u5220\u9664\u952e\u53ef\u5feb\u901f\u5220\u9664\u9009\u4e2dmod<br>\u70b9\u6389mod\u524d\u9762\u7684\u52fe\u53ef\u7981\u7528mod\uff0c\u4e0d\u4f1a\u52a0\u8f7d\uff1b\u9009\u62e9mod\u53ef\u4ee5\u83b7\u53d6mod\u4fe1\u606f</font></html>
|
||||
|
||||
advancedsettings=\u9ad8\u7ea7\u8bbe\u7f6e
|
||||
advancedsettings.launcher_visible=\u542f\u52a8\u5668\u53ef\u89c1\u6027
|
||||
@@ -293,6 +293,7 @@ setupwindow.find_in_configurations=\u5bfc\u5165\u5b8c\u6210\uff0c\u5feb\u5230\u9
|
||||
setupwindow.give_a_name=\u7ed9\u65b0\u6e38\u620f\u8def\u5f84\u8d77\u4e2a\u540d\u5b57\u5427
|
||||
setupwindow.new=\u65b0\u5efa
|
||||
setupwindow.no_empty_name=\u540d\u5b57\u4e0d\u53ef\u4e3a\u7a7a
|
||||
setupwindow.clean=\u6e05\u7406\u6e38\u620f\u6587\u4ef6
|
||||
|
||||
update.no_browser=\u65e0\u6cd5\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u7f51\u5740\u5df2\u7ecf\u590d\u5236\u5230\u526a\u8d34\u677f\u4e86\uff0c\u60a8\u53ef\u4ee5\u624b\u52a8\u7c98\u8d34\u7f51\u5740\u6253\u5f00\u9875\u9762
|
||||
update.should_open_link=\u662f\u5426\u524d\u5f80\u53d1\u5e03\u9875\u9762\u66f4\u65b0\uff1f
|
||||
|
||||
@@ -227,6 +227,7 @@ advancedsettings.no_jvm_args=\u4e0d\u6dfb\u52a0JVM\u53c3\u6578(\u4f7f\u7528Java9
|
||||
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.server_ip=\u76f4\u5165\u670d\u52d9\u5668ip\u5730\u5740(\u4e0d\u5fc5\u586b\u5beb\uff0c\u555f\u52d5\u904a\u6232\u5f8c\u76f4\u63a5\u9032\u5165\u5c0d\u61c9\u670d\u52d9\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)
|
||||
|
||||
mainwindow.show_log=\u67e5\u770b\u65e5\u8a8c
|
||||
mainwindow.make_launch_script=\u751f\u6210\u555f\u52d5\u8173\u672c
|
||||
@@ -272,6 +273,7 @@ assets.not_refreshed=\u8cc7\u6e90\u5217\u8868\u672a\u5237\u65b0\uff0c\u8acb\u523
|
||||
assets.failed=\u7372\u53d6\u5217\u8868\u5931\u6557\uff0c\u8acb\u5237\u65b0\u91cd\u8a66\u3002
|
||||
assets.list.1_7_3_after=1.7.3\u53ca\u4ee5\u5f8c
|
||||
assets.list.1_6=1.6(BMCLAPI)
|
||||
assets.unkown_type_select_one=\u7121\u6cd5\u89e3\u6790\u904a\u6232\u7248\u672c\uff1a%s\uff0c\u8acb\u9078\u64c7\u4e00\u7a2e\u8cc7\u6e90\u985e\u578b\u4e0b\u8f09\u3002
|
||||
assets.type=\u8cc7\u6e90\u985e\u578b
|
||||
assets.download=\u4e0b\u8f09\u8cc7\u6e90
|
||||
assets.no_assets=\u8cc7\u6e90\u6587\u4ef6\u4e0d\u5b8c\u6574\uff0c\u662f\u5426\u88dc\u5168\uff1f
|
||||
@@ -292,6 +294,7 @@ setupwindow.find_in_configurations=\u5c0e\u5165\u5b8c\u6210\uff0c\u5feb\u5230\u9
|
||||
setupwindow.give_a_name=\u7d66\u65b0\u904a\u6232\u8def\u5f91\u8d77\u500b\u540d\u5b57\u5427
|
||||
setupwindow.new=\u65b0\u5efa
|
||||
setupwindow.no_empty_name=\u540d\u5b57\u4e0d\u53ef\u70ba\u7a7a
|
||||
setupwindow.clean=\u6e05\u7406\u904a\u6232\u6587\u4ef6
|
||||
|
||||
update.no_browser=\u7121\u6cd5\u6253\u958b\u700f\u89bd\u5668\uff0c\u7db2\u5740\u5df2\u7d93\u5fa9\u88fd\u5230\u526a\u8cbc\u677f\u4e86\uff0c\u60a8\u53ef\u4ee5\u624b\u52d5\u7c98\u8cbc\u7db2\u5740\u6253\u958b\u9801\u9762
|
||||
update.should_open_link=\u662f\u5426\u524d\u5f80\u767c\u5e03\u9801\u9762\u66f4\u65b0\uff1f
|
||||
|
||||
Reference in New Issue
Block a user