diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/Main.java b/HMCL/src/main/java/org/jackhuang/hmcl/Main.java index b32879ece..5b3752404 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/Main.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/Main.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -25,6 +25,7 @@ import org.jackhuang.hmcl.setting.Settings; import org.jackhuang.hmcl.task.Schedulers; import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.ui.Controllers; +import org.jackhuang.hmcl.upgrade.AppDataUpgrader; import org.jackhuang.hmcl.upgrade.IUpgrader; import org.jackhuang.hmcl.upgrade.UpdateChecker; import org.jackhuang.hmcl.util.*; @@ -60,7 +61,7 @@ public final class Main extends Application { try { // NetworkUtils.setUserAgentSupplier(() -> "Hello Minecraft! Launcher"); Constants.UI_THREAD_SCHEDULER = Constants.JAVAFX_UI_THREAD_SCHEDULER; - IUpgrader.NOW_UPGRADER.parseArguments(VersionNumber.asVersion(VERSION), Arrays.asList(args)); + UPGRADER.parseArguments(VersionNumber.asVersion(VERSION), Arrays.asList(args)); Logging.LOG.info("*** " + TITLE + " ***"); @@ -133,6 +134,7 @@ public final class Main extends Application { public static final String TITLE = NAME + " " + VERSION; public static final ResourceBundle RESOURCE_BUNDLE = Settings.INSTANCE.getLocale().getResourceBundle(); public static final UpdateChecker UPDATE_CHECKER = new UpdateChecker(VersionNumber.asVersion(VERSION)); + public static final IUpgrader UPGRADER = new AppDataUpgrader(); public static final CrashReporter CRASH_REPORTER = new CrashReporter(); public static final String CONTACT = "http://huangyuhui.duapp.com/hmcl.php"; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/event/OutOfDateEvent.java b/HMCL/src/main/java/org/jackhuang/hmcl/event/OutOfDateEvent.java index 60b209253..9f5d25840 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/event/OutOfDateEvent.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/event/OutOfDateEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileChangedEvent.java b/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileChangedEvent.java index 7341e79ac..87d229e44 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileChangedEvent.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileChangedEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileLoadingEvent.java b/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileLoadingEvent.java index 6bd5250c6..f5ef78dc8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileLoadingEvent.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/event/ProfileLoadingEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java index a2796c887..aafe33b16 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/AccountHelper.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLDependencyManager.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLDependencyManager.java index 62f9281b9..5c3e2093b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLDependencyManager.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLDependencyManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameBuilder.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameBuilder.java index 180651a57..a8bd08abc 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameBuilder.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameBuilder.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameDownloadTask.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameDownloadTask.java index 2296bd6c9..b923b708d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameDownloadTask.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -54,7 +54,7 @@ public class HMCLGameDownloadTask extends Task { } @Override - public void execute() throws IOException { + public void execute() { File jar = profile.getRepository().getVersionJar(version); File cache = new File(Settings.INSTANCE.getCommonPath(), "jars/" + gameVersion + ".jar"); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java index 26826f4d4..a999a6e1a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameLauncher.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java index 0230615eb..ee7695306 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLGameRepository.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackExportTask.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackExportTask.java index 8d88f0c23..9cfc8bf37 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackExportTask.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackExportTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackInstallTask.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackInstallTask.java index 2d28a28fe..df29d0ad1 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackInstallTask.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManager.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManager.java index b247a2c01..9e750e492 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManager.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -59,7 +59,7 @@ public final class HMCLModpackManager { return ModAdviser.ModSuggestion.NORMAL; else return ModAdviser.ModSuggestion.SUGGESTED; - }; + } private static boolean match(List l, String fileName, boolean isDirectory) { for (String s : l) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManifest.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManifest.java index f8823b312..14daff199 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManifest.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/HMCLModpackManifest.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java index ee70e5fea..68436a289 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/LauncherHelper.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -108,7 +108,7 @@ public final class LauncherHelper { )); })) .then(variables -> { - DefaultLauncher launcher = variables.get("launcher"); + DefaultLauncher launcher = variables.get("launcher"); if (scriptFile == null) { return new LaunchTask<>(launcher::launch).setName(Main.i18n("version.launch")); } else { @@ -138,7 +138,7 @@ public final class LauncherHelper { launchingStepsPane.setExecutor(executor); executor.addTaskListener(new TaskListener() { - AtomicInteger finished = new AtomicInteger(0); + final AtomicInteger finished = new AtomicInteger(0); @Override public void onFinished(Task task) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/LoadingState.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/LoadingState.java index ed616d3ee..da1ab1c10 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/LoadingState.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/LoadingState.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/ModAdviser.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/ModAdviser.java index ca9d8a70b..ac9fb44ff 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/ModAdviser.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/ModAdviser.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/ModpackHelper.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/ModpackHelper.java index f12f6a861..6c66d5dd9 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/ModpackHelper.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/ModpackHelper.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -106,7 +106,7 @@ public final class ModpackHelper { else throw new IllegalStateException("Unrecognized modpack: " + modpack); } - public static Task getUpdateTask(Profile profile, File zipFile, String name, ModpackConfiguration configuration) throws UnsupportedModpackException, MismatchedModpackTypeException, IOException { + public static Task getUpdateTask(Profile profile, File zipFile, String name, ModpackConfiguration configuration) throws UnsupportedModpackException, MismatchedModpackTypeException { Modpack modpack = ModpackHelper.readModpackManifest(zipFile); switch (configuration.getType()) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/game/MultiMCInstallVersionSettingTask.java b/HMCL/src/main/java/org/jackhuang/hmcl/game/MultiMCInstallVersionSettingTask.java index a3735cda7..329b6a7f9 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/game/MultiMCInstallVersionSettingTask.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/game/MultiMCInstallVersionSettingTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java index 26aaf5ce8..a48f178b6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Accounts.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java index 800ba4408..be3ed382a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Config.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java index ae5fcf6a8..bd56232cf 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumBackgroundImage.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumBackgroundImage.java index d6fe955a3..e12a67420 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumBackgroundImage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumBackgroundImage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumGameDirectory.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumGameDirectory.java index 94d79016b..db1b16fa1 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumGameDirectory.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/EnumGameDirectory.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Fonts.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Fonts.java index e42e5e6d8..1ce4e57f8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Fonts.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Fonts.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/LauncherVisibility.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/LauncherVisibility.java index d58f65f34..45a3de910 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/LauncherVisibility.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/LauncherVisibility.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Locales.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Locales.java index 66d249351..b28b7c5d8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Locales.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Locales.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profile.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profile.java index f5d75b90f..4d56d93d6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profile.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profile.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2013 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profiles.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profiles.java index b41fad711..0f3158d7a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profiles.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Profiles.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Proxies.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Proxies.java index bfce5107b..90abf311e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Proxies.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Proxies.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java index 30d90acf9..b35098556 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Settings.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -97,14 +97,10 @@ public class Settings { for (Map.Entry entry2 : getProfileMap().entrySet()) { entry2.getValue().setName(entry2.getKey()); entry2.getValue().nameProperty().setChangedListener(this::profileNameChanged); - entry2.getValue().addPropertyChangedListener(e -> { - save(); - }); + entry2.getValue().addPropertyChangedListener(e -> save()); } - Lang.ignoringException(() -> { - Runtime.getRuntime().addShutdownHook(new Thread(this::save)); - }); + Lang.ignoringException(() -> Runtime.getRuntime().addShutdownHook(new Thread(this::save))); loadProxy(); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Theme.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Theme.java index 5db748d53..5f4602698 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/Theme.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/Theme.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java index b79465121..6e3e3bf61 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/VersionSetting.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2013 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountItem.java index 5508eef00..592ced84e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -88,9 +88,7 @@ public final class AccountItem extends StackPane { if (account instanceof AuthlibInjectorAccount) { Task.ofResult("serverName", () -> Accounts.getAuthlibInjectorServerName(((AuthlibInjectorAccount) account).getServerBaseURL())) - .subscribe(Schedulers.javafx(), variables -> { - lblServer.setText(variables.get("serverName")); - }); + .subscribe(Schedulers.javafx(), variables -> lblServer.setText(variables.get("serverName"))); } if (account instanceof YggdrasilAccount) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountLoginPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountLoginPane.java index 567fb78c1..6d826b5e7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountLoginPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountLoginPane.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountsPage.java index 4b15c0d7a..b66e0e1d9 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AccountsPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -169,7 +169,6 @@ public final class AccountsPage extends StackPane implements DecoratorPage { progressBar.setVisible(true); lblCreationWarning.setText(""); Task.ofResult("create_account", () -> { - try { Account account; switch (type) { case 0: account = Accounts.ACCOUNT_FACTORY.get(Accounts.OFFLINE_ACCOUNT_KEY).fromUsername(username); break; @@ -181,22 +180,19 @@ public final class AccountsPage extends StackPane implements DecoratorPage { AuthInfo info = account.logIn(new CharacterSelector(), Settings.INSTANCE.getProxy()); Accounts.setCurrentCharacter(account, info.getUsername()); return account; - } catch (Exception e) { - return e; - } - }).subscribe(Schedulers.javafx(), variables -> { - Object account = variables.get("create_account"); - if (account instanceof Account) { - Settings.INSTANCE.addAccount((Account) account); + }).finalized(Schedulers.javafx(), variables -> { + Settings.INSTANCE.addAccount(variables.get("create_account")); + dialog.close(); + loadAccounts(); + progressBar.setVisible(false); + }, exception -> { + if (exception instanceof NoSelectedCharacterException) { dialog.close(); - loadAccounts(); - } else if (account instanceof NoSelectedCharacterException) { - dialog.close(); - } else if (account instanceof Exception) { - lblCreationWarning.setText(accountException((Exception) account)); + } else { + lblCreationWarning.setText(accountException(exception)); } progressBar.setVisible(false); - }); + }).start(); } @FXML @@ -241,10 +237,10 @@ public final class AccountsPage extends StackPane implements DecoratorPage { } private static class CharacterSelector extends BorderPane implements MultiCharacterSelector { - private AdvancedListBox listBox = new AdvancedListBox(); - private JFXButton cancel = new JFXButton(); + private final AdvancedListBox listBox = new AdvancedListBox(); + private final JFXButton cancel = new JFXButton(); - private CountDownLatch latch = new CountDownLatch(1); + private final CountDownLatch latch = new CountDownLatch(1); private GameProfile selectedProfile = null; { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServerItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServerItem.java index 9e35a66d8..722f71738 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServerItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServerItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java index e24d06237..592100871 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/AuthlibInjectorServersPage.java @@ -43,7 +43,7 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa @FXML private JFXProgressBar progressBar; @FXML private JFXButton btnAddNext; - private TransitionHandler transitionHandler; + private final TransitionHandler transitionHandler; { FXUtils.loadFXML(this, "/assets/fxml/authlib-injector-servers.fxml"); @@ -53,9 +53,8 @@ public class AuthlibInjectorServersPage extends StackPane implements DecoratorPa getChildren().remove(dialog); dialog.setDialogContainer(this); - txtServerIp.textProperty().addListener((a, b, newValue) -> { - btnAddNext.setDisable(!txtServerIp.validate()); - }); + txtServerIp.textProperty().addListener((a, b, newValue) -> + btnAddNext.setDisable(!txtServerIp.validate())); loading(); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java index 1775d91fd..20b0c8791 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Controllers.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/CrashWindow.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/CrashWindow.java index 6eb1f9225..e9e4eb16c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/CrashWindow.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/CrashWindow.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -34,20 +34,19 @@ import org.jackhuang.hmcl.Main; */ public class CrashWindow extends Stage { - private Label lblCrash = new Label(); - private Button btnContact = new Button(); - private TextArea textArea = new TextArea(); - public CrashWindow(String text) { + Label lblCrash = new Label(); if (Main.UPDATE_CHECKER.isOutOfDate()) lblCrash.setText(Main.i18n("launcher.crash_out_dated")); else lblCrash.setText(Main.i18n("launcher.crash")); lblCrash.setWrapText(true); + TextArea textArea = new TextArea(); textArea.setText(text); textArea.setEditable(false); + Button btnContact = new Button(); btnContact.setText(Main.i18n("launcher.contact")); btnContact.setOnMouseClicked(event -> FXUtils.openLink(Main.CONTACT)); HBox box = new HBox(); @@ -68,9 +67,7 @@ public class CrashWindow extends Stage { getIcons().add(new Image("/assets/img/icon.png")); setTitle(Main.i18n("message.error")); - setOnCloseRequest(e -> { - System.exit(1); - }); + setOnCloseRequest(e -> System.exit(1)); } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java index 3e2ef8ea3..bfd8ede29 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/Decorator.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -85,7 +85,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza private double xOffset, yOffset, newX, newY, initX, initY; private boolean allowMove, isDragging, dialogShown, maximized; private BoundingBox originalBox, maximizedBox; - private TransitionHandler animationHandler; + private final TransitionHandler animationHandler; @FXML private StackPane contentPlaceHolder; @@ -205,7 +205,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza } } - // bgskin + // images in ./bg if (!loaded) { File backgroundImageFile = new File("bg"); if (backgroundImageFile.isDirectory()) { @@ -302,52 +302,52 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza if (!this.primaryStage.isFullScreen() && !mouseEvent.isStillSincePress() && !this.primaryStage.isMaximized() && !this.maximized) { this.newX = mouseEvent.getScreenX(); this.newY = mouseEvent.getScreenY(); - double deltax = this.newX - this.initX; - double deltay = this.newY - this.initY; + double deltaX = this.newX - this.initX; + double deltaY = this.newY - this.initY; Cursor cursor = this.getCursor(); if (Cursor.E_RESIZE == cursor) { - this.setStageWidth(this.primaryStage.getWidth() + deltax); + this.setStageWidth(this.primaryStage.getWidth() + deltaX); mouseEvent.consume(); } else if (Cursor.NE_RESIZE == cursor) { - if (this.setStageHeight(this.primaryStage.getHeight() - deltay)) { - this.primaryStage.setY(this.primaryStage.getY() + deltay); + if (this.setStageHeight(this.primaryStage.getHeight() - deltaY)) { + this.primaryStage.setY(this.primaryStage.getY() + deltaY); } - this.setStageWidth(this.primaryStage.getWidth() + deltax); + this.setStageWidth(this.primaryStage.getWidth() + deltaX); mouseEvent.consume(); } else if (Cursor.SE_RESIZE == cursor) { - this.setStageWidth(this.primaryStage.getWidth() + deltax); - this.setStageHeight(this.primaryStage.getHeight() + deltay); + this.setStageWidth(this.primaryStage.getWidth() + deltaX); + this.setStageHeight(this.primaryStage.getHeight() + deltaY); mouseEvent.consume(); } else if (Cursor.S_RESIZE == cursor) { - this.setStageHeight(this.primaryStage.getHeight() + deltay); + this.setStageHeight(this.primaryStage.getHeight() + deltaY); mouseEvent.consume(); } else if (Cursor.W_RESIZE == cursor) { - if (this.setStageWidth(this.primaryStage.getWidth() - deltax)) { - this.primaryStage.setX(this.primaryStage.getX() + deltax); + if (this.setStageWidth(this.primaryStage.getWidth() - deltaX)) { + this.primaryStage.setX(this.primaryStage.getX() + deltaX); } mouseEvent.consume(); } else if (Cursor.SW_RESIZE == cursor) { - if (this.setStageWidth(this.primaryStage.getWidth() - deltax)) { - this.primaryStage.setX(this.primaryStage.getX() + deltax); + if (this.setStageWidth(this.primaryStage.getWidth() - deltaX)) { + this.primaryStage.setX(this.primaryStage.getX() + deltaX); } - this.setStageHeight(this.primaryStage.getHeight() + deltay); + this.setStageHeight(this.primaryStage.getHeight() + deltaY); mouseEvent.consume(); } else if (Cursor.NW_RESIZE == cursor) { - if (this.setStageWidth(this.primaryStage.getWidth() - deltax)) { - this.primaryStage.setX(this.primaryStage.getX() + deltax); + if (this.setStageWidth(this.primaryStage.getWidth() - deltaX)) { + this.primaryStage.setX(this.primaryStage.getX() + deltaX); } - if (this.setStageHeight(this.primaryStage.getHeight() - deltay)) { - this.primaryStage.setY(this.primaryStage.getY() + deltay); + if (this.setStageHeight(this.primaryStage.getHeight() - deltaY)) { + this.primaryStage.setY(this.primaryStage.getY() + deltaY); } mouseEvent.consume(); } else if (Cursor.N_RESIZE == cursor) { - if (this.setStageHeight(this.primaryStage.getHeight() - deltay)) { - this.primaryStage.setY(this.primaryStage.getY() + deltay); + if (this.setStageHeight(this.primaryStage.getHeight() - deltaY)) { + this.primaryStage.setY(this.primaryStage.getY() + deltaY); } mouseEvent.consume(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogController.java index 7cabf931d..2031be43e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogController.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java index 84133508b..78aadfebe 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -30,7 +30,10 @@ import javafx.beans.value.WeakChangeListener; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Node; -import javafx.scene.control.*; +import javafx.scene.control.ListView; +import javafx.scene.control.ScrollBar; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.Tooltip; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; @@ -39,6 +42,7 @@ import javafx.scene.layout.Region; import javafx.scene.shape.Rectangle; import javafx.util.Duration; import org.jackhuang.hmcl.Main; +import org.jackhuang.hmcl.util.ExceptionalSupplier; import org.jackhuang.hmcl.util.Lang; import org.jackhuang.hmcl.util.Logging; import org.jackhuang.hmcl.util.OperatingSystem; @@ -47,7 +51,6 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.util.List; -import java.util.Optional; import java.util.function.Consumer; import java.util.logging.Level; @@ -90,8 +93,8 @@ public final class FXUtils { } private static class ListenerPair { - ObservableValue value; - ChangeListener listener; + private final ObservableValue value; + private final ChangeListener listener; ListenerPair(ObservableValue value, ChangeListener listener) { this.value = value; @@ -187,7 +190,7 @@ public final class FXUtils { FXMLLoader loader = new FXMLLoader(node.getClass().getResource(absolutePath), Main.RESOURCE_BUNDLE); loader.setRoot(node); loader.setController(node); - Lang.invoke(() -> loader.load()); + Lang.invoke((ExceptionalSupplier) loader::load); } public static void resetChildren(JFXMasonryPane pane, List children) { @@ -196,6 +199,10 @@ public final class FXUtils { pane.getChildren().setAll(children); } + public static void installTooltip(Node node, String tooltip) { + installTooltip(node, 0, 5000, 0, new Tooltip(tooltip)); + } + public static void installTooltip(Node node, double openDelay, double visibleDelay, double closeDelay, Tooltip tooltip) { try { // Java 8 @@ -215,35 +222,6 @@ public final class FXUtils { } } - public static boolean alert(Alert.AlertType type, String title, String contentText) { - return alert(type, title, contentText, null); - } - - public static boolean alert(Alert.AlertType type, String title, String contentText, String headerText) { - Alert alert = new Alert(type); - alert.setTitle(title); - alert.setHeaderText(headerText); - alert.setContentText(contentText); - Optional result = alert.showAndWait(); - return result.isPresent() && result.get() == ButtonType.OK; - } - - public static Optional inputDialog(String title, String contentText) { - return inputDialog(title, contentText, null); - } - - public static Optional inputDialog(String title, String contentText, String headerText) { - return inputDialog(title, contentText, headerText, ""); - } - - public static Optional inputDialog(String title, String contentText, String headerText, String defaultValue) { - TextInputDialog dialog = new TextInputDialog(defaultValue); - dialog.setTitle(title); - dialog.setHeaderText(headerText); - dialog.setContentText(contentText); - return dialog.showAndWait(); - } - public static void openFolder(File file) { file.mkdirs(); String path = file.getAbsolutePath(); @@ -328,9 +306,8 @@ public final class FXUtils { @SuppressWarnings("unchecked") public static void bindEnum(JFXComboBox comboBox, Property property) { unbindEnum(comboBox); - ChangeListener listener = (a, b, newValue) -> { - ((Property) property).setValue(property.getValue().getClass().getEnumConstants()[newValue.intValue()]); - }; + ChangeListener listener = (a, b, newValue) -> + ((Property) property).setValue(property.getValue().getClass().getEnumConstants()[newValue.intValue()]); comboBox.getSelectionModel().select(property.getValue().ordinal()); comboBox.getProperties().put("FXUtils.bindEnum.listener", listener); comboBox.getSelectionModel().selectedIndexProperty().addListener(listener); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerController.java index 1d80c06fc..42e83d96b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerController.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java index 98da25790..f227d90ca 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/InstallerItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java index 43b9bd235..9463740ba 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LeftPaneController.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -47,7 +47,6 @@ import org.jackhuang.hmcl.ui.construct.ClassTitle; import org.jackhuang.hmcl.ui.construct.IconedItem; import org.jackhuang.hmcl.ui.construct.RipplerContainer; import org.jackhuang.hmcl.util.Lang; -import org.jackhuang.hmcl.util.Pair; import java.io.File; import java.util.LinkedList; @@ -72,9 +71,7 @@ public final class LeftPaneController { iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage())); })) .add(new ClassTitle(Lang.apply(new BorderPane(), borderPane -> { - borderPane.setLeft(Lang.apply(new VBox(), vBox -> { - vBox.getChildren().setAll(new Text(Main.i18n("profile.title").toUpperCase())); - })); + borderPane.setLeft(Lang.apply(new VBox(), vBox -> vBox.getChildren().setAll(new Text(Main.i18n("profile.title").toUpperCase())))); JFXButton addProfileButton = new JFXButton(); addProfileButton.setGraphic(SVG.plus("black", 10, 10)); addProfileButton.getStyleClass().add("toggle-icon-tiny"); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LogWindow.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LogWindow.java index 9e8a34fdb..b6589527d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/LogWindow.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/LogWindow.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2013 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -70,9 +70,7 @@ public final class LogWindow extends Stage { public LogWindow(String text) { this(); - onDone.register(() -> { - logLine(text, Log4jLevel.INFO); - }); + onDone.register(() -> logLine(text, Log4jLevel.INFO)); } public ReadOnlyIntegerProperty fatalProperty() { @@ -164,7 +162,7 @@ public final class LogWindow extends Stage { @FXML private ComboBox cboLines; - WebEngine engine; + final WebEngine engine; Node body; Document document; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java index 3fd754721..f1374017d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/MainPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -26,7 +26,6 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.fxml.FXML; import javafx.scene.Node; -import javafx.scene.control.Tooltip; import javafx.scene.image.Image; import javafx.scene.input.MouseButton; import javafx.scene.layout.StackPane; @@ -75,7 +74,7 @@ public final class MainPage extends StackPane implements DecoratorPage { @FXML private JFXListView versionList; - private JFXPopup versionPopup; + private final JFXPopup versionPopup; { FXUtils.loadFXML(this, "/assets/fxml/main.fxml"); @@ -88,9 +87,9 @@ public final class MainPage extends StackPane implements DecoratorPage { getChildren().remove(versionList); btnAdd.setOnMouseClicked(e -> Controllers.getDecorator().startWizard(new DownloadWizardProvider(), Main.i18n("install"))); - FXUtils.installTooltip(btnAdd, 0, 5000, 0, new Tooltip(Main.i18n("install"))); + FXUtils.installTooltip(btnAdd, Main.i18n("install")); btnRefresh.setOnMouseClicked(e -> Settings.INSTANCE.getSelectedProfile().getRepository().refreshVersionsAsync().start()); - FXUtils.installTooltip(btnRefresh, 0, 5000, 0, new Tooltip(Main.i18n("button.refresh"))); + FXUtils.installTooltip(btnRefresh, Main.i18n("button.refresh")); } private Node buildNode(Profile profile, String version, String game) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModController.java index ad3e3babf..bf8acc767 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModController.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -127,13 +127,12 @@ public final class ModController { }); variables.set("list", list); } - }).subscribe(Schedulers.javafx(), variables -> { + }).finalized(Schedulers.javafx(), variables -> { FXUtils.onWeakChangeAndOperate(parentTab.getSelectionModel().selectedItemProperty(), newValue -> { if (newValue != null && newValue.getUserData() == ModController.this) modPane.getChildren().setAll(variables.>get("list")); }); - }); - + }, null).start(); } @FXML @@ -144,7 +143,12 @@ public final class ModController { File res = chooser.showOpenDialog(Controllers.getStage()); if (res == null) return; Task.of(() -> modManager.addMod(versionId, res)) - .subscribe(Task.of(Schedulers.javafx(), () -> loadMods(modManager, versionId))); + .finalized(Schedulers.javafx(), (variables, isDependentsSucceeded) -> { + if (isDependentsSucceeded) + loadMods(modManager, versionId); + else + Controllers.dialog("mods.failed"); + }).start(); } public void setParentTab(JFXTabPane parentTab) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModItem.java index 4f9d0a7c9..d85b5e06b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/ModItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -21,39 +21,37 @@ import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXCheckBox; import com.jfoenix.effects.JFXDepthManager; import javafx.geometry.Pos; -import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; -import javafx.scene.layout.VBox; import org.jackhuang.hmcl.Main; import org.jackhuang.hmcl.mod.ModInfo; import java.util.function.Consumer; -public final class ModItem extends BorderPane { - private final TwoLineListItem modItem = new TwoLineListItem(); - private final JFXCheckBox chkEnabled = new JFXCheckBox(); +public final class ModItem extends BorderPane { public ModItem(ModInfo info, Consumer deleteCallback) { + JFXCheckBox chkEnabled = new JFXCheckBox(); BorderPane.setAlignment(chkEnabled, Pos.CENTER); setLeft(chkEnabled); + TwoLineListItem modItem = new TwoLineListItem(); BorderPane.setAlignment(modItem, Pos.CENTER); setCenter(modItem); - JFXButton right = new JFXButton(); - right.setOnMouseClicked(e -> deleteCallback.accept(this)); - right.getStyleClass().add("toggle-icon4"); - BorderPane.setAlignment(right, Pos.CENTER); - right.setGraphic(SVG.close("black", 15, 15)); - setRight(right); + JFXButton btnRemove = new JFXButton(); + FXUtils.installTooltip(btnRemove, Main.i18n("mods.remove")); + btnRemove.setOnMouseClicked(e -> deleteCallback.accept(this)); + btnRemove.getStyleClass().add("toggle-icon4"); + BorderPane.setAlignment(btnRemove, Pos.CENTER); + btnRemove.setGraphic(SVG.close("black", 15, 15)); + setRight(btnRemove); setStyle("-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;"); JFXDepthManager.setDepth(this, 1); modItem.setTitle(info.getFileName()); modItem.setSubtitle(info.getName() + ", " + Main.i18n("archive.version") + ": " + info.getVersion() + ", " + Main.i18n("archive.game_version") + ": " + info.getGameVersion() + ", " + Main.i18n("archive.author") + ": " + info.getAuthors()); chkEnabled.setSelected(info.isActive()); - chkEnabled.selectedProperty().addListener((a, b, newValue) -> { - info.activeProperty().set(newValue); - }); + chkEnabled.selectedProperty().addListener((a, b, newValue) -> + info.activeProperty().set(newValue)); } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/ProfilePage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/ProfilePage.java index ecffe19de..890dce392 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/ProfilePage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/ProfilePage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java index 2c9c23d45..f1b7d08b8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SVG.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SafeIntStringConverter.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SafeIntStringConverter.java index a2ef2039f..548b218fc 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SafeIntStringConverter.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SafeIntStringConverter.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java index b9f4b2090..0ae0e7244 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/SettingsPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -23,7 +23,10 @@ import javafx.beans.property.StringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; -import javafx.scene.control.*; +import javafx.scene.control.Label; +import javafx.scene.control.ScrollPane; +import javafx.scene.control.Toggle; +import javafx.scene.control.ToggleGroup; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; @@ -158,13 +161,11 @@ public final class SettingsPage extends StackPane implements DecoratorPage { chkManualProxy.setSelected(true); proxyPane.disableProperty().bind(chkNoProxy.selectedProperty()); - hasProxyGroup.selectedToggleProperty().addListener((a, b, newValue) -> { - Settings.INSTANCE.setHasProxy(newValue != chkNoProxy); - }); + hasProxyGroup.selectedToggleProperty().addListener((a, b, newValue) -> + Settings.INSTANCE.setHasProxy(newValue != chkNoProxy)); - proxyConfigurationGroup.selectedToggleProperty().addListener((a, b, newValue) -> { - Settings.INSTANCE.setProxyType((Proxy.Type) newValue.getUserData()); - }); + proxyConfigurationGroup.selectedToggleProperty().addListener((a, b, newValue) -> + Settings.INSTANCE.setProxyType((Proxy.Type) newValue.getUserData())); chkProxyAuthentication.setSelected(Settings.INSTANCE.hasProxyAuth()); chkProxyAuthentication.selectedProperty().addListener((a, b, newValue) -> Settings.INSTANCE.setHasProxyAuth(newValue)); @@ -172,7 +173,7 @@ public final class SettingsPage extends StackPane implements DecoratorPage { fileCommonLocation.setProperty(Settings.INSTANCE.commonPathProperty()); - FXUtils.installTooltip(btnUpdate, 0, 5000, 0, new Tooltip(Main.i18n("update.tooltip"))); + FXUtils.installTooltip(btnUpdate, Main.i18n("update.tooltip")); checkUpdate(); // background @@ -189,9 +190,8 @@ public final class SettingsPage extends StackPane implements DecoratorPage { Settings.INSTANCE.backgroundImageTypeProperty().setChangedListener(it -> initBackgroundItemSubtitle()); initBackgroundItemSubtitle(); - backgroundItem.setToggleSelectedListener(newValue -> { - Settings.INSTANCE.setBackgroundImageType((EnumBackgroundImage) newValue.getUserData()); - }); + backgroundItem.setToggleSelectedListener(newValue -> + Settings.INSTANCE.setBackgroundImageType((EnumBackgroundImage) newValue.getUserData())); // theme themeItem.loadChildren(Arrays.asList( diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/TwoLineListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/TwoLineListItem.java index 6794e8d6c..b4380785e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/TwoLineListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/TwoLineListItem.java @@ -1,6 +1,7 @@ package org.jackhuang.hmcl.ui; -import javafx.beans.property.*; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.css.*; import javafx.scene.Node; import javafx.scene.control.Label; @@ -9,8 +10,6 @@ import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.paint.Paint; import javafx.scene.text.Font; -import org.jackhuang.hmcl.ui.construct.RipplerContainer; -import org.jackhuang.hmcl.util.Pair; import java.util.ArrayList; import java.util.Collections; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java index 86e40d7bf..d9f6018bd 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -22,7 +22,6 @@ import javafx.beans.binding.Bindings; import javafx.event.EventHandler; import javafx.fxml.FXML; import javafx.scene.control.Label; -import javafx.scene.control.Tooltip; import javafx.scene.effect.BlurType; import javafx.scene.effect.DropShadow; import javafx.scene.image.Image; @@ -73,10 +72,10 @@ public final class VersionItem extends StackPane { btnLaunch.setGraphic(SVG.launch("black", 15, 15)); btnScript.setGraphic(SVG.script("black", 15, 15)); - FXUtils.installTooltip(btnSettings, 0, 5000, 0, new Tooltip(Main.i18n("version.settings"))); - FXUtils.installTooltip(btnUpdate, 0, 5000, 0, new Tooltip(Main.i18n("version.update"))); - FXUtils.installTooltip(btnLaunch, 0, 5000, 0, new Tooltip(Main.i18n("version.launch"))); - FXUtils.installTooltip(btnScript, 0, 5000, 0, new Tooltip(Main.i18n("version.launch_script"))); + FXUtils.installTooltip(btnSettings, Main.i18n("version.settings")); + FXUtils.installTooltip(btnUpdate, Main.i18n("version.update")); + FXUtils.installTooltip(btnLaunch, Main.i18n("version.launch")); + FXUtils.installTooltip(btnScript, Main.i18n("version.launch_script")); icon.translateYProperty().bind(Bindings.createDoubleBinding(() -> header.getBoundsInParent().getHeight() - icon.getHeight() / 2 - 16, header.boundsInParentProperty(), icon.heightProperty())); FXUtils.limitSize(iconView, 32, 32); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java index e929fcad2..7078d9dd9 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionListItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionPage.java index 222bc6719..c5e7bd0bd 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -25,7 +25,6 @@ import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.fxml.FXML; import javafx.scene.control.Tab; -import javafx.scene.control.Tooltip; import javafx.scene.layout.StackPane; import org.jackhuang.hmcl.Main; import org.jackhuang.hmcl.download.game.GameAssetIndexDownloadTask; @@ -66,8 +65,8 @@ public final class VersionPage extends StackPane implements DecoratorPage { @FXML private JFXTabPane tabPane; - private JFXPopup browsePopup; - private JFXPopup managementPopup; + private final JFXPopup browsePopup; + private final JFXPopup managementPopup; private Profile profile; private String version; @@ -80,10 +79,10 @@ public final class VersionPage extends StackPane implements DecoratorPage { browsePopup = new JFXPopup(browseList); managementPopup = new JFXPopup(managementList); - FXUtils.installTooltip(btnDelete, 0, 5000, 0, new Tooltip(Main.i18n("version.manage.remove"))); - FXUtils.installTooltip(btnBrowseMenu, 0, 5000, 0, new Tooltip(Main.i18n("settings.game.exploration"))); - FXUtils.installTooltip(btnManagementMenu, 0, 5000, 0, new Tooltip(Main.i18n("settings.game.management"))); - FXUtils.installTooltip(btnExport, 0, 5000, 0, new Tooltip(Main.i18n("modpack.export"))); + FXUtils.installTooltip(btnDelete, Main.i18n("version.manage.remove")); + FXUtils.installTooltip(btnBrowseMenu, Main.i18n("settings.game.exploration")); + FXUtils.installTooltip(btnManagementMenu, Main.i18n("settings.game.management")); + FXUtils.installTooltip(btnExport, Main.i18n("modpack.export")); } public void load(String id, Profile profile) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionSettingsController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionSettingsController.java index 752f8f07f..deaae9e97 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionSettingsController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/VersionSettingsController.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -24,7 +24,6 @@ import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; import javafx.scene.control.Toggle; -import javafx.scene.control.Tooltip; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; @@ -83,11 +82,9 @@ public final class VersionSettingsController { FXUtils.smoothScrolling(scroll); - Task.of(variables -> { - variables.set("list", JavaVersion.getJREs().values().stream().map(javaVersion -> - javaItem.createChildren(javaVersion.getVersion(), javaVersion.getBinary().getAbsolutePath(), javaVersion) - ).collect(Collectors.toList())); - }).subscribe(Schedulers.javafx(), variables -> + Task.of(variables -> variables.set("list", JavaVersion.getJREs().values().stream().map(javaVersion -> + javaItem.createChildren(javaVersion.getVersion(), javaVersion.getBinary().getAbsolutePath(), javaVersion) + ).collect(Collectors.toList()))).subscribe(Schedulers.javafx(), variables -> javaItem.loadChildren(variables.>get("list")) ); @@ -104,7 +101,7 @@ public final class VersionSettingsController { globalItem.createChildren(Main.i18n("settings.type.special"), false) )); - FXUtils.installTooltip(btnIconSelection, 0, 5000, 0, new Tooltip(Main.i18n("button.edit"))); + FXUtils.installTooltip(btnIconSelection, Main.i18n("button.edit")); } public void loadVersionSetting(Profile profile, String versionId) { @@ -202,9 +199,7 @@ public final class VersionSettingsController { .findFirst().ifPresent(toggle -> toggle.setSelected(true)); gameDirItem.setCustomUserData(EnumGameDirectory.CUSTOM); - gameDirItem.setToggleSelectedListener(newValue -> { - versionSetting.setGameDirType((EnumGameDirectory) newValue.getUserData()); - }); + gameDirItem.setToggleSelectedListener(newValue -> versionSetting.setGameDirType((EnumGameDirectory) newValue.getUserData())); versionSetting.gameDirProperty().setChangedListener(it -> initGameDirSubtitle(versionSetting)); versionSetting.gameDirTypeProperty().setChangedListener(it -> initGameDirSubtitle(versionSetting)); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/WebStage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/WebStage.java index 83148a583..34089f027 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/WebStage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/WebStage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationHandler.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationHandler.java index b8e50c9a6..5cfa76893 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationHandler.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationHandler.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationProducer.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationProducer.java index 769312445..0fa2925cf 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationProducer.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/AnimationProducer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/ContainerAnimations.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/ContainerAnimations.java index 4bbacc1b2..5c3f977a0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/ContainerAnimations.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/ContainerAnimations.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright c 2017 huangyuhui + * Copyright c 2018 huangyuhui * * 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 @@ -83,7 +83,7 @@ public enum ContainerAnimations { new KeyValue(c.getCurrentNode().translateXProperty(), 0, Interpolator.EASE_BOTH), new KeyValue(c.getPreviousNode().translateXProperty(), c.getCurrentRoot().getWidth(), Interpolator.EASE_BOTH)))); - private AnimationProducer animationProducer; + private final AnimationProducer animationProducer; ContainerAnimations(AnimationProducer animationProducer) { this.animationProducer = animationProducer; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionHandler.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionHandler.java index 0fb21b342..1dba20f34 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionHandler.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/animation/TransitionHandler.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -73,9 +73,7 @@ public final class TransitionHandler implements AnimationHandler { Timeline nowAnimation = new Timeline(); nowAnimation.getKeyFrames().addAll(transition.animate(this)); - nowAnimation.getKeyFrames().add(new KeyFrame(duration, e -> { - view.getChildren().remove(previousNode); - })); + nowAnimation.getKeyFrames().add(new KeyFrame(duration, e -> view.getChildren().remove(previousNode))); nowAnimation.play(); animation = nowAnimation; } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListBox.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListBox.java index 5c4d63420..2cad4d23c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListBox.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/AdvancedListBox.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ClassTitle.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ClassTitle.java index cbf39b02f..90abf3c26 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ClassTitle.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ClassTitle.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentList.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentList.java index 5d92f9972..b79bfb431 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentList.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentListCell.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentListCell.java index 78b73329b..d18a304b4 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentListCell.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/ComponentListCell.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -35,7 +35,7 @@ import org.jackhuang.hmcl.ui.FXUtils; import org.jackhuang.hmcl.ui.SVG; /** - * @author + * @author huangyuhui */ public class ComponentListCell extends StackPane { private final Node content; @@ -146,9 +146,8 @@ public class ComponentListCell extends StackPane { expandAnimation.play(); }); - expandedProperty().addListener((a, b, newValue) -> { - expandIcon.setRotate(newValue ? 180 : 0); - }); + expandedProperty().addListener((a, b, newValue) -> + expandIcon.setRotate(newValue ? 180 : 0)); getChildren().setAll(holder); } else diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FileItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FileItem.java index 3699f2c93..6b64924c2 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FileItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FileItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -53,7 +53,7 @@ public class FileItem extends BorderPane { right.setGraphic(SVG.pencil("black", 15, 15)); right.getStyleClass().add("toggle-icon4"); right.setOnMouseClicked(e -> onExplore()); - FXUtils.installTooltip(right, 0, 5000, 0, new Tooltip(Main.i18n("button.edit"))); + FXUtils.installTooltip(right, Main.i18n("button.edit")); setRight(right); Tooltip tip = new Tooltip(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FontComboBox.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FontComboBox.java index 6d293cb7d..9af52cff5 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FontComboBox.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/FontComboBox.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedItem.java index b421bda87..46c4aab27 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/InputDialogPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/InputDialogPane.java index 7fc59d97b..75512829b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/InputDialogPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/InputDialogPane.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageBox.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageBox.java index 7f6a4023d..8321ba075 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageBox.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageBox.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -106,12 +106,12 @@ public final class MessageBox { * @param title The title of MsgBox. * @return user operation. */ - public static void show(String message, String title) { + public static Optional show(String message, String title) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(title); alert.setHeaderText(title); alert.setContentText(message); - alert.showAndWait(); + return alert.showAndWait(); } public static int confirm(String message, String title) { diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java index 6421049b9..5b17ae8a6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 4017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MultiFileItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MultiFileItem.java index 720610781..896aab2ed 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MultiFileItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MultiFileItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -52,7 +52,7 @@ public class MultiFileItem extends ComponentList { private final StringProperty chooserTitle = new SimpleStringProperty(this, "chooserTitle", Main.i18n("selector.choose_file")); private final BooleanProperty directory = new SimpleBooleanProperty(this, "directory", false); private final SimpleStringProperty tooltip = new SimpleStringProperty(this, "tooltip"); - private ObservableList extensionFilters = FXCollections.observableArrayList(); + private final ObservableList extensionFilters = FXCollections.observableArrayList(); private final ToggleGroup group = new ToggleGroup(); private final JFXTextField txtCustom = new JFXTextField(); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NoneMultipleSelectionModel.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NoneMultipleSelectionModel.java index cbebe3e2c..6b3031c9c 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NoneMultipleSelectionModel.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NoneMultipleSelectionModel.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NumberValidator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NumberValidator.java index c1feb0f13..c22f0c48b 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NumberValidator.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/NumberValidator.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -23,7 +23,7 @@ import javafx.scene.control.TextInputControl; import org.jackhuang.hmcl.util.StringUtils; public class NumberValidator extends ValidatorBase { - private boolean nullable; + private final boolean nullable; public NumberValidator() { this(false); diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/RipplerContainer.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/RipplerContainer.java index 55270bd74..6f9d070bf 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/RipplerContainer.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/RipplerContainer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java index 5fce68699..249b4dd57 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogWizardDisplayer.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogWizardDisplayer.java index a1dea6b39..f79b14805 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogWizardDisplayer.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogWizardDisplayer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java index 056f94344..2ffdf8edb 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/UTF8Control.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/UTF8Control.java index f5a9d85b9..d77d236f6 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/UTF8Control.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/UTF8Control.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Validator.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Validator.java index 54c88ff1f..b06b5cb49 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Validator.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/Validator.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AdditionalInstallersPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AdditionalInstallersPage.java index e36e5b137..7f73aa0ca 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AdditionalInstallersPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/AdditionalInstallersPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.java index 3062478f3..585b401b8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/DownloadWizardProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallTypePage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallTypePage.java index e37615ee6..701db869d 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallTypePage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallTypePage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallerWizardProvider.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallerWizardProvider.java index 2ee89c5eb..e18b39cb0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallerWizardProvider.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallerWizardProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java index 8b69ad1db..d64c21be0 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/InstallersPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/ModpackPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/ModpackPage.java index 9839c0b64..072f55ff5 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/ModpackPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/ModpackPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java index 360fd4e64..d664f8266 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPageItem.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPageItem.java index bc4efaa30..794b70f27 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPageItem.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/download/VersionsPageItem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ExportWizardProvider.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ExportWizardProvider.java index 8686237bf..791fe235e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ExportWizardProvider.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ExportWizardProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.java index 1f8f1e025..82cb9f1b4 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackFileSelectionPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -52,7 +52,7 @@ public final class ModpackFileSelectionPage extends StackPane implements WizardP private final ModAdviser adviser; @FXML private JFXTreeView treeView; - private CheckBoxTreeItem rootNode; + private final CheckBoxTreeItem rootNode; public ModpackFileSelectionPage(WizardController controller, Profile profile, String version, ModAdviser adviser) { this.controller = controller; diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackInfoPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackInfoPage.java index f235cbca6..3911c154e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackInfoPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/export/ModpackInfoPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/AbstractWizardDisplayer.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/AbstractWizardDisplayer.java index ed51416e2..7b90defa7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/AbstractWizardDisplayer.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/AbstractWizardDisplayer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DecoratorPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DecoratorPage.java index 79da0413d..239e3ee5e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DecoratorPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DecoratorPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DefaultWizardDisplayer.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DefaultWizardDisplayer.java index 928a53c0b..356bb0ac3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DefaultWizardDisplayer.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/DefaultWizardDisplayer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Navigation.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Navigation.java index d60af667b..97da3e83e 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Navigation.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Navigation.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Refreshable.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Refreshable.java index d8d27a6d7..0c8fd8320 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Refreshable.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Refreshable.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Summary.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Summary.java index 96d2eb146..fd1d7724a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Summary.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Summary.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Wizard.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Wizard.java index 5d3f9bdba..c04a40737 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Wizard.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/Wizard.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardController.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardController.java index 1fb61447b..85f8725b8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardController.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardController.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardDisplayer.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardDisplayer.java index a7f508670..32960ae50 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardDisplayer.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardDisplayer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardNavigationResult.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardNavigationResult.java index 1a5620264..d063d9dd8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardNavigationResult.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardNavigationResult.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardPage.java index c1558fa72..43f03edf2 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardPage.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardProvider.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardProvider.java index 8bb6fc4f1..58b23b6ba 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardProvider.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/wizard/WizardProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/AppDataUpgrader.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/AppDataUpgrader.java index a7e60e87f..1fb1d2ce3 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/AppDataUpgrader.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/AppDataUpgrader.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/IUpgrader.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/IUpgrader.java index e3cc37df8..c4e3a12b7 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/IUpgrader.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/IUpgrader.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -27,8 +27,6 @@ import java.util.List; */ public abstract class IUpgrader { - public static final IUpgrader NOW_UPGRADER = new AppDataUpgrader(); - /** * Paring arguments to decide on whether the upgrade is needed. * @@ -42,8 +40,6 @@ public abstract class IUpgrader { * * @param checker Should be VersionChecker * @param version the newest version - * - * @return should return true */ public abstract void download(UpdateChecker checker, VersionNumber version); } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/NewFileUpgrader.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/NewFileUpgrader.java index 2ed95ba26..728626a0a 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/NewFileUpgrader.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/NewFileUpgrader.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java index d320c8769..9e209b655 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/upgrade/UpdateChecker.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -40,7 +40,7 @@ import java.util.logging.Level; public final class UpdateChecker { private volatile boolean outOfDate = false; - private VersionNumber base; + private final VersionNumber base; private String versionString; private Map download_link = null; @@ -134,7 +134,7 @@ public final class UpdateChecker { public void checkOutdate() { if (outOfDate) if (EventBus.EVENT_BUS.fireEvent(new OutOfDateEvent(this, getNewVersion())) != Event.Result.DENY) { - IUpgrader.NOW_UPGRADER.download(this, getNewVersion()); + Main.UPGRADER.download(this, getNewVersion()); } } } diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/util/CrashReporter.java b/HMCL/src/main/java/org/jackhuang/hmcl/util/CrashReporter.java index 5efd70a9c..b927743f8 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/util/CrashReporter.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/util/CrashReporter.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/util/I18nException.java b/HMCL/src/main/java/org/jackhuang/hmcl/util/I18nException.java index db951dc64..cb46ebc01 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/util/I18nException.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/util/I18nException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index 8a1309b17..40c28956a 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -296,7 +296,7 @@ mods=Mods mods.add=Add mods.choose_mod=Choose your mods mods.default_information=Please ensure that you have installed Forge or LiteLoader before installing mods!\nYou can drop your mod files from explorer/finder, and delete mods by the delete button.\nDisable a mod by leaving the check box unchecked; Choose an item to get the information. -mods.failed=Failed to add mods +mods.failed=Unable to add your mod mods.remove=Remove operation.confirm_stop=Terminate the operations? diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 24a065c15..56a0ac6e1 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -45,7 +45,7 @@ account.injector.server_ip=服务器地址 account.injector.server_name=服务器名称 account.methods=登录方式 account.methods.authlib_injector=authlib-injector 登录 -account.methods.no_method=没有登入方式... +account.methods.no_method=没有登入方式 account.methods.offline=离线模式 account.methods.yggdrasil=正版登录 account.missing=没有账户 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/Account.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/Account.java index 827a5bb11..fbbd350ff 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/Account.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/Account.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -82,7 +82,7 @@ public abstract class Account { return storage; } - private Map properties = new HashMap<>(); + private final Map properties = new HashMap<>(); /** * To save some necessary extra information here. diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AccountFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AccountFactory.java index 096a54a01..5a52dc7ec 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AccountFactory.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AccountFactory.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthInfo.java index 4eed07e0b..bea067300 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthenticationException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthenticationException.java index 3c2036976..1ff9f998b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthenticationException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/AuthenticationException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidCredentialsException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidCredentialsException.java index 4bf30f271..373e196a9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidCredentialsException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidCredentialsException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidPasswordException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidPasswordException.java index c4ccba465..eaec730fa 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidPasswordException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidPasswordException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -22,7 +22,7 @@ package org.jackhuang.hmcl.auth; */ public class InvalidPasswordException extends AuthenticationException { - private Account account; + private final Account account; public InvalidPasswordException(Account account) { super(); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidTokenException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidTokenException.java index 7aeffdebb..7cc06340e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidTokenException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/InvalidTokenException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -25,7 +25,7 @@ import org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccount; */ public class InvalidTokenException extends AuthenticationException { - private YggdrasilAccount account; + private final YggdrasilAccount account; public InvalidTokenException(YggdrasilAccount account) { super(); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/MultiCharacterSelector.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/MultiCharacterSelector.java index c59e26d6e..2495af28b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/MultiCharacterSelector.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/MultiCharacterSelector.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoCharacterException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoCharacterException.java index 2e2a9033e..86c90f9ec 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoCharacterException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoCharacterException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoSelectedCharacterException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoSelectedCharacterException.java index 64db45335..20ef569fb 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoSelectedCharacterException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/NoSelectedCharacterException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccount.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccount.java index ec3d8fcad..cdcd416b1 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccount.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccount.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccountFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccountFactory.java index 9b1da88a6..5d231d772 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccountFactory.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/OfflineAccountFactory.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/ServerDisconnectException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/ServerDisconnectException.java index 4ccbaefb2..4a5bd8069 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/ServerDisconnectException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/ServerDisconnectException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/SpecificCharacterSelector.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/SpecificCharacterSelector.java index 7a31cd267..081018eb2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/SpecificCharacterSelector.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/SpecificCharacterSelector.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/UserType.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/UserType.java index 6d99686e0..06fb43cbc 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/UserType.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/UserType.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationRequest.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationRequest.java index 50b464e01..221c368f7 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationRequest.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationRequest.java @@ -1,7 +1,19 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.auth.yggdrasil; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationResponse.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationResponse.java index efd5488a7..46b006e6e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationResponse.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthenticationResponse.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccount.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccount.java index 570782f72..06068d888 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccount.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccount.java @@ -1,3 +1,20 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.auth.yggdrasil; import org.jackhuang.hmcl.auth.AuthInfo; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccountFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccountFactory.java index c106a4cd9..11ab4974b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccountFactory.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorAccountFactory.java @@ -9,7 +9,6 @@ import org.jackhuang.hmcl.util.UUIDTypeAdapter; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.function.Supplier; import static org.jackhuang.hmcl.auth.yggdrasil.AuthlibInjectorAccount.STORAGE_KEY_SERVER_BASE_URL; import static org.jackhuang.hmcl.auth.yggdrasil.YggdrasilAccount.*; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorBuildInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorBuildInfo.java index 0d3ed21f8..56fbbe937 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorBuildInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorBuildInfo.java @@ -1,3 +1,20 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.auth.yggdrasil; import com.google.gson.JsonParseException; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerInfo.java index 0c5e9c7c5..c9cba830d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerInfo.java @@ -1,3 +1,20 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.auth.yggdrasil; public class AuthlibInjectorServerInfo { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerResponse.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerResponse.java index 3600adf2f..210333766 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerResponse.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/AuthlibInjectorServerResponse.java @@ -1,3 +1,20 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.auth.yggdrasil; public class AuthlibInjectorServerResponse { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/GameProfile.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/GameProfile.java index 47533cf54..3a83c39a0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/GameProfile.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/GameProfile.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileResponse.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileResponse.java index 4a419099d..1bb562f23 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileResponse.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileResponse.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileTexture.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileTexture.java index 997cfdb4b..e78705112 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileTexture.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ProfileTexture.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/Property.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/Property.java index 2110bd88e..b52c0b3db 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/Property.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/Property.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/PropertyMap.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/PropertyMap.java index 7152223ec..1abdb4758 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/PropertyMap.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/PropertyMap.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/RefreshRequest.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/RefreshRequest.java index 6e39b3da6..297dc3341 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/RefreshRequest.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/RefreshRequest.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/TextureResponse.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/TextureResponse.java index 9e9b43da1..6285d1dfe 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/TextureResponse.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/TextureResponse.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/User.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/User.java index 7f1be0172..f7f664bbb 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/User.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/User.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ValidateRequest.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ValidateRequest.java index 0d90bcbec..dc089c2ad 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ValidateRequest.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/ValidateRequest.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java index 6e4a1d81c..351718c62 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccount.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java index 302e493fb..e31d5a401 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/auth/yggdrasil/YggdrasilAccountFactory.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/AbstractDependencyManager.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/AbstractDependencyManager.java index 1776429a7..f30c269ba 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/AbstractDependencyManager.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/AbstractDependencyManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java index af982eef4..8f2e2da3b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/BMCLAPIDownloadProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultDependencyManager.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultDependencyManager.java index b56e006cc..21a93a7a5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultDependencyManager.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultDependencyManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultGameBuilder.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultGameBuilder.java index da9a920c0..092d8e713 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultGameBuilder.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DefaultGameBuilder.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -25,9 +25,6 @@ import org.jackhuang.hmcl.util.AutoTypingMap; import org.jackhuang.hmcl.util.Constants; import org.jackhuang.hmcl.util.ExceptionalFunction; -import java.io.IOException; -import java.util.function.Function; - /** * * @author huangyuhui diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DependencyManager.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DependencyManager.java index a48148760..c7b442e6a 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DependencyManager.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DependencyManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DownloadProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DownloadProvider.java index 75610a353..d6ef16928 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DownloadProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/DownloadProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/GameBuilder.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/GameBuilder.java index f997eeb87..d7910806d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/GameBuilder.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/GameBuilder.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -32,7 +32,7 @@ public abstract class GameBuilder { protected String name = ""; protected String gameVersion = ""; - protected Map toolVersions = new HashMap<>(); + protected final Map toolVersions = new HashMap<>(); public String getName() { return name; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MaintainTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MaintainTask.java index 2daf1d281..67406e788 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MaintainTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MaintainTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -17,17 +17,13 @@ */ package org.jackhuang.hmcl.download; -import org.jackhuang.hmcl.download.game.VersionJsonSaveTask; import org.jackhuang.hmcl.game.GameRepository; import org.jackhuang.hmcl.game.Library; import org.jackhuang.hmcl.game.Version; -import org.jackhuang.hmcl.task.Schedulers; -import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.task.TaskResult; import org.jackhuang.hmcl.util.StringUtils; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; public class MaintainTask extends TaskResult { @@ -47,7 +43,7 @@ public class MaintainTask extends TaskResult { } @Override - public void execute() throws Exception { + public void execute() { Version newVersion = version; Library forge = null, liteLoader = null, optiFine = null; List args = new ArrayList<>(StringUtils.tokenize(newVersion.getMinecraftArguments().orElse(""))); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java index a6c4b4f0a..bd9252b44 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/MojangDownloadProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -23,7 +23,7 @@ import org.jackhuang.hmcl.download.liteloader.LiteLoaderVersionList; import org.jackhuang.hmcl.download.optifine.OptiFineVersionList; /** - * @see {@link http://wiki.vg} + * @see http://wiki,vg * @author huangyuhui */ public final class MojangDownloadProvider implements DownloadProvider { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/RemoteVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/RemoteVersion.java index dece5587c..94d6fa10a 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/RemoteVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/RemoteVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -19,7 +19,6 @@ package org.jackhuang.hmcl.download; import org.jackhuang.hmcl.util.VersionNumber; -import java.util.Comparator; import java.util.Objects; /** diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/VersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/VersionList.java index c0c6f4fe6..aaf7295f8 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/VersionList.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/VersionList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -25,7 +25,7 @@ import java.util.*; /** * The remote version list. * - * @param T The type of {@code RemoteVersion}, the type of tags. + * @param The type of {@code RemoteVersion}, the type of tags. * * @author huangyuhui */ diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstall.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstall.java index 4d871cb2f..2eb19fb2d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstall.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstall.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallProfile.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallProfile.java index 614a63cc1..c856f8ff4 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallProfile.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallProfile.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallTask.java index e3317e4ac..10df8748d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersion.java index 2323b43bd..d1b7e9bb2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -36,6 +36,10 @@ public final class ForgeVersion implements Validation { private final double modified; private final String[][] files; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public ForgeVersion() { this(null, null, null, null, 0, 0, null); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionList.java index 289706a1d..555fbcd1c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionList.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionRoot.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionRoot.java index a5efb9163..a64985f4d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionRoot.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/forge/ForgeVersionRoot.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -40,6 +40,10 @@ public final class ForgeVersionRoot implements Validation { private final Map promos; private final Map number; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public ForgeVersionRoot() { this(null, null, null, null, null, null, null, null, null); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetDownloadTask.java index 0604aec17..be65124e9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetIndexDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetIndexDownloadTask.java index 9f01eba64..9e1878024 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetIndexDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetIndexDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetRefreshTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetRefreshTask.java index 3f56945fb..cc2d8f743 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetRefreshTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameAssetRefreshTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameDownloadTask.java index b6effe99c..336c675b7 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLibrariesTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLibrariesTask.java index 3c6686f04..0bb73acd0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLibrariesTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLibrariesTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLoggingDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLoggingDownloadTask.java index ef4e14c76..981de53f0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLoggingDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameLoggingDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteLatestVersions.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteLatestVersions.java index 81755c704..8bf4f8abd 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteLatestVersions.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteLatestVersions.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersion.java index 7ee39cfce..cf5e720c8 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersionTag.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersionTag.java index 7ef53c4b4..5eb09685e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersionTag.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersionTag.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -32,6 +32,10 @@ public final class GameRemoteVersionTag { private final ReleaseType type; private final Date time; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public GameRemoteVersionTag() { this(ReleaseType.UNKNOWN, new Date()); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersions.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersions.java index 43503ad7e..3e3de34d2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersions.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameRemoteVersions.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -36,6 +36,10 @@ public final class GameRemoteVersions { @SerializedName("latest") private final GameRemoteLatestVersions latest; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public GameRemoteVersions() { this(Collections.emptyList(), null); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameVersionList.java index 13800be7a..94b262931 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameVersionList.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/GameVersionList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -24,11 +24,9 @@ import org.jackhuang.hmcl.task.GetTask; import org.jackhuang.hmcl.task.Task; import org.jackhuang.hmcl.util.Constants; import org.jackhuang.hmcl.util.NetworkUtils; -import org.jackhuang.hmcl.util.VersionNumber; import java.util.Collection; import java.util.Collections; -import java.util.Optional; /** * diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/LibrariesUniqueTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/LibrariesUniqueTask.java index 1e71b8e21..9a4fcb694 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/LibrariesUniqueTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/LibrariesUniqueTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -40,7 +40,7 @@ public class LibrariesUniqueTask extends TaskResult { } @Override - public void execute() throws Exception { + public void execute() { List libraries = new ArrayList<>(version.getLibraries()); Map versionMap = new HashMap<>(); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonDownloadTask.java index 12c414a07..ff660ba7d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonSaveTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonSaveTask.java index 9c12645b6..a961c790e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonSaveTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/game/VersionJsonSaveTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderBranch.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderBranch.java index 850a5cdac..8d09e7636 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderBranch.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderBranch.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -38,6 +38,10 @@ public final class LiteLoaderBranch { @SerializedName("com.mumfrey:liteloader") private final Map liteLoader; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public LiteLoaderBranch() { this(Collections.emptySet(), Collections.emptyMap()); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderGameVersions.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderGameVersions.java index 4a1dff251..1d6481b07 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderGameVersions.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderGameVersions.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -36,6 +36,10 @@ public final class LiteLoaderGameVersions { @SerializedName("snapshots") private final LiteLoaderBranch snapshots; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public LiteLoaderGameVersions() { this(null, null, null); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderInstallTask.java index 823e9b11b..81e26dc1b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRemoteVersionTag.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRemoteVersionTag.java index 4629755fe..0914ec74c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRemoteVersionTag.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRemoteVersionTag.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -30,8 +30,12 @@ public final class LiteLoaderRemoteVersionTag { private final String tweakClass; private final Collection libraries; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public LiteLoaderRemoteVersionTag() { - this("", Collections.EMPTY_SET); + this("", Collections.emptySet()); } public LiteLoaderRemoteVersionTag(String tweakClass, Collection libraries) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRepository.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRepository.java index 0f106d4f9..7c8420e1b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRepository.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderRepository.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -39,6 +39,10 @@ public final class LiteLoaderRepository { @SerializedName("classifier") private final String classifier; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public LiteLoaderRepository() { this("", "", "", ""); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersion.java index 31bd892bb..88e8642e8 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -37,8 +37,12 @@ public final class LiteLoaderVersion { private final int lastSuccessfulBuild; private final Collection libraries; + /** + * No-arg constructor for Gson. + */ + @SuppressWarnings("unused") public LiteLoaderVersion() { - this("", "", "", "", "", 0, Collections.EMPTY_SET); + this("", "", "", "", "", 0, Collections.emptySet()); } public LiteLoaderVersion(String tweakClass, String file, String version, String md5, String timestamp, int lastSuccessfulBuild, Collection libraries) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionList.java index 43b3c8043..2f8596b15 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionList.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -28,13 +28,9 @@ import org.jackhuang.hmcl.util.VersionNumber; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.io.IOException; import java.util.Collection; import java.util.Collections; import java.util.Map; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsMeta.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsMeta.java index b5fafa97b..a7daffc57 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsMeta.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsMeta.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsRoot.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsRoot.java index ab71d328d..a744bf0f5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsRoot.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/liteloader/LiteLoaderVersionsRoot.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -37,7 +37,7 @@ public final class LiteLoaderVersionsRoot { private final LiteLoaderVersionsMeta meta; public LiteLoaderVersionsRoot() { - this(Collections.EMPTY_MAP, null); + this(Collections.emptyMap(), null); } public LiteLoaderVersionsRoot(Map versions, LiteLoaderVersionsMeta meta) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineBMCLVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineBMCLVersionList.java index 6f99a6510..b3be207f1 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineBMCLVersionList.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineBMCLVersionList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineInstallTask.java index 1e11d0a69..872192437 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineRemoteVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineRemoteVersion.java index a28073e34..421e12a2c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineRemoteVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineRemoteVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersion.java index fbe460a78..14b25f832 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersionList.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersionList.java index 71c485b31..cfc3212a5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersionList.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/download/optifine/OptiFineVersionList.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -18,7 +18,6 @@ package org.jackhuang.hmcl.download.optifine; import org.jackhuang.hmcl.download.DownloadProvider; -import org.jackhuang.hmcl.download.RemoteVersion; import org.jackhuang.hmcl.download.VersionList; import org.jackhuang.hmcl.task.GetTask; import org.jackhuang.hmcl.task.Task; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/Event.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/Event.java index 9f9097601..68eb7c5e4 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/Event.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/Event.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventBus.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventBus.java index 0b64d6bd5..ea3ede46e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventBus.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventBus.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -27,12 +27,14 @@ public final class EventBus { private final HashMap, EventManager> events = new HashMap<>(); + @SuppressWarnings("unchecked") public EventManager channel(Class clazz) { if (!events.containsKey(clazz)) events.put(clazz, new EventManager<>()); return (EventManager) events.get(clazz); } + @SuppressWarnings("unchecked") public Event.Result fireEvent(Event obj) { return channel((Class) obj.getClass()).fireEvent(obj); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventManager.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventManager.java index efda37653..c66764c93 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventManager.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventPriority.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventPriority.java index 7a91df59d..df23486f0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventPriority.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/EventPriority.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/FailedEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/FailedEvent.java index 288bdfb1e..e8dc70810 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/FailedEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/FailedEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/GameJsonParseFailedEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/GameJsonParseFailedEvent.java index 44faf1cc7..011bda099 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/GameJsonParseFailedEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/GameJsonParseFailedEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/JVMLaunchFailedEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/JVMLaunchFailedEvent.java index dcc851a4c..70e75d259 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/JVMLaunchFailedEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/JVMLaunchFailedEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/LoadedOneVersionEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/LoadedOneVersionEvent.java index 4c778a5f0..e71bac3a6 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/LoadedOneVersionEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/LoadedOneVersionEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessExitedAbnormallyEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessExitedAbnormallyEvent.java index b0d526c0a..410ee1759 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessExitedAbnormallyEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessExitedAbnormallyEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessStoppedEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessStoppedEvent.java index 4fc0271ea..7786c13d5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessStoppedEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/ProcessStoppedEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshedVersionsEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshedVersionsEvent.java index 53f57623d..64d55662e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshedVersionsEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshedVersionsEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshingVersionsEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshingVersionsEvent.java index 101dab30e..f85c09d29 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshingVersionsEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/event/RefreshingVersionsEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Argument.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Argument.java index 9a76cb4c2..07eaa62ab 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Argument.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Argument.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Arguments.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Arguments.java index b714b7260..a2be04601 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Arguments.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Arguments.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndex.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndex.java index ebade171c..cbe60bf79 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndex.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndex.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndexInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndexInfo.java index 7e6149f9f..7f1a78114 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndexInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetIndexInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetObject.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetObject.java index c5ec93e99..cd6b7c624 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetObject.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/AssetObject.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CircleDependencyException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CircleDependencyException.java index 43d641a4c..512c1f641 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CircleDependencyException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CircleDependencyException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicLibrary.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicLibrary.java index 30e2c6290..991e1f9b3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicLibrary.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicLibrary.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicVersion.java index e08fa12b0..0d9d8869d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ClassicVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CompatibilityRule.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CompatibilityRule.java index 5d96aaf20..f9f5a1ba3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CompatibilityRule.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/CompatibilityRule.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java index e82aece0a..231e99ffd 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DefaultGameRepository.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadInfo.java index 0ec7b7340..08fdd4f64 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadType.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadType.java index 3a3931a90..3698edab3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadType.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/DownloadType.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ExtractRules.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ExtractRules.java index a8ed46440..b94433eaa 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ExtractRules.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ExtractRules.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameException.java index f97c25899..4f9446cbe 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameRepository.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameRepository.java index c354b393f..1616ada6f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameRepository.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameRepository.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -26,7 +26,8 @@ import java.util.Collection; /** * Supports operations on versioning. * - * Note that game repository will not do any tasks that connect to Internet, if do, see {@link org.jackhuang.hmcl.download.DependencyManager} + * Note that game repository will not do any operations which need connection with Internet, if do, + * see {@link org.jackhuang.hmcl.download.DependencyManager} * * @author huangyuhui */ @@ -94,8 +95,8 @@ public interface GameRepository extends VersionProvider { * Get the library file in disk. * This method allows versions and libraries that are not loaded by this game repository. * - * @param version versionversion - * @param lib the library, [Version.libraries] + * @param version the reference of game version + * @param lib the library, {@link Version#getLibraries()} * @return the library file */ File getLibraryFile(Version version, Library lib); @@ -104,8 +105,9 @@ public interface GameRepository extends VersionProvider { * Get the directory that native libraries will be unzipped to. * * You'd better return a unique directory. - * Or if it returns a temporary directory, [org.jackhuang.hmcl.launch.Launcher.makeLaunchScript] will fail. - * If you do want to return a temporary directory, make [org.jackhuang.hmcl.launch.Launcher.makeLaunchScript] always fail([UnsupportedOperationException]) and not to use it. + * Or if it returns a temporary directory, {@link org.jackhuang.hmcl.launch.Launcher#makeLaunchScript} will fail. + * If you do want to return a temporary directory, make {@link org.jackhuang.hmcl.launch.Launcher#makeLaunchScript} + * always fail({@code UnsupportedOperationException}) and not to use it. * * @param id version id * @return the native directory @@ -145,8 +147,8 @@ public interface GameRepository extends VersionProvider { * Will reconstruct assets or do some blocking tasks if necessary. * You'd better create a new thread to invoke this method. * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.actualAssetIndex.id] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} * @return the actual asset directory */ File getActualAssetDirectory(String version, String assetId); @@ -154,8 +156,8 @@ public interface GameRepository extends VersionProvider { /** * Get the asset directory according to the asset id. * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.actualAssetIndex.id] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} * @return the asset directory */ File getAssetDirectory(String version, String assetId); @@ -163,9 +165,9 @@ public interface GameRepository extends VersionProvider { /** * Get the file that given asset object refers to * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.actualAssetIndex.id] - * @param name the asset object name, you can find it in [AssetIndex.objects.keys] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} + * @param name the asset object name, you can find it in keys of {@link AssetIndex#getObjects()} * @throws java.io.IOException if I/O operation fails. * @return the file that given asset object refers to */ @@ -174,9 +176,9 @@ public interface GameRepository extends VersionProvider { /** * Get the file that given asset object refers to * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.actualAssetIndex.id] - * @param obj the asset object, you can find it in [AssetIndex.objects] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} + * @param obj the asset object, you can find it in {@link AssetIndex#getObjects()} * @return the file that given asset object refers to */ File getAssetObject(String version, String assetId, AssetObject obj); @@ -184,8 +186,8 @@ public interface GameRepository extends VersionProvider { /** * Get asset index that assetId represents * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.actualAssetIndex.id] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} * @return the asset index */ AssetIndex getAssetIndex(String version, String assetId) throws IOException; @@ -193,16 +195,16 @@ public interface GameRepository extends VersionProvider { /** * Get the asset_index.json which includes asset objects information. * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.actualAssetIndex.id] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} */ File getIndexFile(String version, String assetId); /** * Get logging object * - * @param version the id of specific version that is relevant to [assetId] - * @param assetId the asset id, you can find it in [AssetIndexInfo.id] [Version.assets] + * @param version the id of specific version that is relevant to {@code assetId} + * @param assetId the asset id, you can find it in {@link AssetIndexInfo#getId()} {@link Version#getAssetIndex()} * @param loggingInfo the logging info * @return the file that loggingInfo refers to */ diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameVersion.java index 58d9596d2..0f6d31303 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/GameVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -117,9 +117,9 @@ public final class GameVersion { if (minecraft != null) return getVersionOfOldMinecraft(f, minecraft); ZipArchiveEntry main = f.getEntry("net/minecraft/client/main/Main.class"); - ZipArchiveEntry minecraftserver = f.getEntry("net/minecraft/server/MinecraftServer.class"); - if ((main != null) && (minecraftserver != null)) - return getVersionOfNewMinecraft(f, minecraftserver); + ZipArchiveEntry minecraftServer = f.getEntry("net/minecraft/server/MinecraftServer.class"); + if ((main != null) && (minecraftServer != null)) + return getVersionOfNewMinecraft(f, minecraftServer); return Optional.empty(); } catch (IOException e) { return Optional.empty(); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/IdDownloadInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/IdDownloadInfo.java index d09fa3c22..90383620e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/IdDownloadInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/IdDownloadInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java index bb6167776..27146d257 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LaunchOptions.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -194,7 +194,7 @@ public class LaunchOptions implements Serializable { public static class Builder { - LaunchOptions options = new LaunchOptions(); + private final LaunchOptions options = new LaunchOptions(); public LaunchOptions create() { return options; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibrariesDownloadInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibrariesDownloadInfo.java index ed3999e7f..219c5e93b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibrariesDownloadInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibrariesDownloadInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -34,7 +34,7 @@ public final class LibrariesDownloadInfo { private final Map classifiers; public LibrariesDownloadInfo(LibraryDownloadInfo artifact) { - this(artifact, Collections.EMPTY_MAP); + this(artifact, Collections.emptyMap()); } public LibrariesDownloadInfo(LibraryDownloadInfo artifact, Map classifiers) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Library.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Library.java index b783e192f..eb1af8268 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Library.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Library.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibraryDownloadInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibraryDownloadInfo.java index 6c5ff93f3..121960bfb 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibraryDownloadInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LibraryDownloadInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java index f11e9b570..809f10897 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/LoggingInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java index 2e8d1c09a..24a055110 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/OSRestriction.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ReleaseType.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ReleaseType.java index b93d03b9f..6d5a041a5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ReleaseType.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/ReleaseType.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java index 3dfb93350..2f46a177e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/RuledArgument.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -91,14 +91,13 @@ public class RuledArgument implements Argument { @Override public RuledArgument deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject obj = json.getAsJsonObject(); - RuledArgument a = new RuledArgument( + return new RuledArgument( context.deserialize(obj.get("rules"), new TypeToken>() { }.getType()), obj.get("value").isJsonPrimitive() ? Collections.singletonList(obj.get("value").getAsString()) : context.deserialize(obj.get("value"), new TypeToken>() { }.getType())); - return a; } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/SimpleVersionProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/SimpleVersionProvider.java index 084ad2c0a..2dab95189 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/SimpleVersionProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/SimpleVersionProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java index a757fcf3f..61f0f317e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/Version.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionNotFoundException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionNotFoundException.java index 26220711a..9062ae65e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionNotFoundException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionNotFoundException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionProvider.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionProvider.java index 64819f63b..15b85ffe1 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionProvider.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/game/VersionProvider.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java index bfdcc85e8..6090a7b86 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/DefaultLauncher.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -366,6 +366,6 @@ public class DefaultLauncher extends Launcher { managedProcess.addLine(it); }), "stderr-pump", isDaemon); managedProcess.addRelatedThread(stderr); - managedProcess.addRelatedThread(Lang.thread(new ExitWaiter(managedProcess, Arrays.asList(stdout, stderr), (exitCode, exitType) -> processListener.onExit(exitCode, exitType)), "exit-waiter", isDaemon)); + managedProcess.addRelatedThread(Lang.thread(new ExitWaiter(managedProcess, Arrays.asList(stdout, stderr), processListener::onExit), "exit-waiter", isDaemon)); } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ExitWaiter.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ExitWaiter.java index 728c37dbb..beeb8478e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ExitWaiter.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ExitWaiter.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Launcher.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Launcher.java index 48f7062ec..a3768e499 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Launcher.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Launcher.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Log4jHandler.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Log4jHandler.java index 3d5da7539..106387d65 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Log4jHandler.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/Log4jHandler.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -34,12 +34,10 @@ import java.util.Date; import java.util.LinkedList; import java.util.List; import java.util.Optional; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiConsumer; import java.util.logging.Level; -import java.util.stream.Collectors; /** * This class is to parse log4j classic XML layout logging, @@ -62,7 +60,7 @@ final class Log4jHandler extends Thread { this.callback = callback; newLine(""); - reader = Lang.invoke(() -> XMLReaderFactory.createXMLReader()); + reader = Lang.invoke((ExceptionalSupplier) XMLReaderFactory::createXMLReader); reader.setContentHandler(new Log4jHandlerImpl()); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/NotDecompressingNativesException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/NotDecompressingNativesException.java index f7ab07176..1a27ebf58 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/NotDecompressingNativesException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/NotDecompressingNativesException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/PermissionException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/PermissionException.java index 0c7f21168..dc7453fad 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/PermissionException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/PermissionException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessCreationException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessCreationException.java index 69674008f..488c6f7b3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessCreationException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessCreationException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessListener.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessListener.java index cd5cecd19..63e52d605 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessListener.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/ProcessListener.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/StreamPump.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/StreamPump.java index bfb1a9d89..ed193b7e2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/StreamPump.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/launch/StreamPump.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseCompletionTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseCompletionTask.java index 3fa64a3eb..2a5cf85c3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseCompletionTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseCompletionTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseInstallTask.java index 3f536725f..8e2be29af 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -109,7 +109,8 @@ public final class CurseInstallTask extends Task { File oldFile = new File(run, "mods/" + oldCurseManifestFile.getFileName()); if (!oldFile.exists()) continue; if (manifest.getFiles().stream().noneMatch(oldCurseManifestFile::equals)) - oldFile.delete(); + if (!oldFile.delete()) + throw new IOException("Unable to delete mod file " + oldFile); } dependencies.add(new CurseCompletionTask(dependencyManager, name)); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifest.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifest.java index 1e013dbaf..fbb900f1b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifest.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifest.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -60,7 +60,7 @@ public final class CurseManifest { private final List files; public CurseManifest() { - this(MINECRAFT_MODPACK, 1, "", "1.0", "", "overrides", new CurseManifestMinecraft(), Collections.EMPTY_LIST); + this(MINECRAFT_MODPACK, 1, "", "1.0", "", "overrides", new CurseManifestMinecraft(), Collections.emptyList()); } public CurseManifest(String manifestType, int manifestVersion, String name, String version, String author, String overrides, CurseManifestMinecraft minecraft, List files) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestFile.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestFile.java index 5c5ed4b2d..dc3566450 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestFile.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestFile.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestMinecraft.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestMinecraft.java index 255b21c4a..9a47144ec 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestMinecraft.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestMinecraft.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -42,7 +42,7 @@ public final class CurseManifestMinecraft implements Validation { public CurseManifestMinecraft() { this.gameVersion = ""; - this.modLoaders = Collections.EMPTY_LIST; + this.modLoaders = Collections.emptyList(); } public CurseManifestMinecraft(String gameVersion, List modLoaders) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestModLoader.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestModLoader.java index 5749d8bed..026c8614a 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestModLoader.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/CurseManifestModLoader.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ForgeModMetadata.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ForgeModMetadata.java index abc5cd947..65487bfd5 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ForgeModMetadata.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ForgeModMetadata.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LiteModMetadata.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LiteModMetadata.java index 30c21866b..49343125c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LiteModMetadata.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/LiteModMetadata.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MinecraftInstanceTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MinecraftInstanceTask.java index 713340246..6b8f0df54 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MinecraftInstanceTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MinecraftInstanceTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MismatchedModpackTypeException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MismatchedModpackTypeException.java index c2942b1be..6a0513d39 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MismatchedModpackTypeException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MismatchedModpackTypeException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -27,4 +27,12 @@ public class MismatchedModpackTypeException extends Exception { this.required = required; this.found = found; } + + public String getRequired() { + return required; + } + + public String getFound() { + return found; + } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModInfo.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModInfo.java index 35646c86e..e09613627 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModInfo.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModInfo.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModManager.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModManager.java index 929a0bf61..c203ebfea 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModManager.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModManager.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -36,7 +36,7 @@ public final class ModManager { this.repository = repository; } - public Collection refreshMods(String id) { + public void refreshMods(String id) { modCache.removeKey(id); File modsDirectory = new File(repository.getRunDirectory(id), "mods"); Consumer puter = modFile -> Lang.ignoringException(() -> modCache.put(id, ModInfo.fromFile(modFile))); @@ -46,7 +46,6 @@ public final class ModManager { else puter.accept(modFile); })); - return modCache.get(id); } public Collection getMods(String id) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java index da56c8659..10fcfcf95 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/Modpack.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackConfiguration.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackConfiguration.java index 341bd82f7..35e8da716 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackConfiguration.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackConfiguration.java @@ -92,7 +92,7 @@ public final class ModpackConfiguration implements Validation { /** * The relative path to Minecraft run directory - * @return + * @return the relative path to Minecraft run directory. */ public String getPath() { return path; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackInstallTask.java index 5fed87069..26f54de38 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/ModpackInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java index 3d37ada8b..f5d71b5e9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstanceConfiguration.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -145,7 +145,7 @@ public final class MultiMCInstanceConfiguration { } /** - * The JVM's arguments + * The JVM arguments */ public String getJvmArgs() { return jvmArgs; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstancePatch.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstancePatch.java index 022970cef..9b68e86e6 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstancePatch.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCInstancePatch.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -47,7 +47,7 @@ public final class MultiMCInstancePatch { private final List libraries; public MultiMCInstancePatch() { - this("", "", "", "", "", Collections.EMPTY_LIST, Collections.EMPTY_LIST); + this("", "", "", "", "", Collections.emptyList(), Collections.emptyList()); } public MultiMCInstancePatch(String name, String version, String gameVersion, String mainClass, String fileId, List tweakers, List libraries) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java index e678e3c1d..b2539f3b3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/MultiMCModpackInstallTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/UnsupportedModpackException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/UnsupportedModpackException.java index 089898a02..52b26ef6f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/UnsupportedModpackException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/mod/UnsupportedModpackException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/CoupleTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/CoupleTask.java index 2ad8b0712..3c4fd92bc 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/CoupleTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/CoupleTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java index ac6b0d960..9723660c8 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FileDownloadTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedCallback.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedCallback.java index 89fb9d791..ad844c267 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedCallback.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedCallback.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedTask.java index dbfd695c7..6ecc5ab52 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/FinalizedTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/GetTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/GetTask.java index 6caf8dc31..a04f4135c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/GetTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/GetTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/ParallelTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/ParallelTask.java index 52ad66f13..aa540af81 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/ParallelTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/ParallelTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Scheduler.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Scheduler.java index e82712112..b8c970a7f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Scheduler.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Scheduler.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerExecutorService.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerExecutorService.java index 1667fbf5e..047be1069 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerExecutorService.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerExecutorService.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerImpl.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerImpl.java index 375d18307..fd60ab640 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerImpl.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SchedulerImpl.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Schedulers.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Schedulers.java index 2087e1458..793ed8575 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Schedulers.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Schedulers.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -34,8 +34,7 @@ public final class Schedulers { if (CACHED_EXECUTOR == null) CACHED_EXECUTOR = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60, TimeUnit.SECONDS, new SynchronousQueue<>(), runnable -> { - Thread thread = Executors.defaultThreadFactory().newThread(runnable); - return thread; + return Executors.defaultThreadFactory().newThread(runnable); }); return CACHED_EXECUTOR; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SilentException.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SilentException.java index 753407857..20e8e4049 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SilentException.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SilentException.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTask.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTask.java index 05e96f123..9b078179c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTask.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTask.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTaskResult.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTaskResult.java index 3804beebf..a8b293e4d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTaskResult.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/SimpleTaskResult.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Task.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Task.java index 34811fda2..d00b7f688 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Task.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/Task.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -83,8 +83,6 @@ public abstract class Task { * True if requires all {@link #getDependents} finishing successfully. *

* **Note** if this field is set false, you are not supposed to invoke [run] - * - * @defaultValue true */ public boolean isRelyingOnDependents() { return true; @@ -94,8 +92,6 @@ public abstract class Task { * True if requires all {@link #getDependencies} finishing successfully. *

* **Note** if this field is set false, you are not supposed to invoke [run] - * - * @defaultValue false */ public boolean isRelyingOnDependencies() { return true; @@ -222,26 +218,24 @@ public abstract class Task { return executor().test(); } - public final TaskExecutor subscribe(Task subscriber) { - TaskExecutor executor = new TaskExecutor(with(subscriber)); - executor.start(); - return executor; + public final void subscribe(Task subscriber) { + new TaskExecutor(then(subscriber)).start(); } - public final TaskExecutor subscribe(Scheduler scheduler, ExceptionalConsumer, ?> closure) { - return subscribe(of(scheduler, closure)); + public final void subscribe(Scheduler scheduler, ExceptionalConsumer, ?> closure) { + subscribe(of(scheduler, closure)); } - public final TaskExecutor subscribe(Scheduler scheduler, ExceptionalRunnable closure) { - return subscribe(of(scheduler, ExceptionalConsumer.fromRunnable(closure))); + public final void subscribe(Scheduler scheduler, ExceptionalRunnable closure) { + subscribe(of(scheduler, ExceptionalConsumer.fromRunnable(closure))); } - public final TaskExecutor subscribe(ExceptionalConsumer, ?> closure) { - return subscribe(of(closure)); + public final void subscribe(ExceptionalConsumer, ?> closure) { + subscribe(of(closure)); } - public final TaskExecutor subscribe(ExceptionalRunnable closure) { - return subscribe(of(closure)); + public final void subscribe(ExceptionalRunnable closure) { + subscribe(of(closure)); } public final Task then(Task b) { @@ -268,6 +262,19 @@ public abstract class Task { return new FinalizedTask(this, scheduler, b); } + public final Task finalized(Scheduler scheduler, ExceptionalConsumer, T> success, ExceptionalConsumer failure) { + return finalized(scheduler, (variables, isDependentsSucceeded) -> { + if (isDependentsSucceeded) { + if (success != null) + success.accept(variables); + } + else { + if (failure != null) + failure.accept(variables.get(TaskExecutor.LAST_EXCEPION_ID)); + } + }); + } + public static Task empty() { return of(ExceptionalConsumer.empty()); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable.java index 13986c29f..8989e41f3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable2.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable2.java index a8cfac016..3ce93edb6 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable2.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskCallable2.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -41,7 +41,7 @@ class TaskCallable2 extends TaskResult { } @Override - public void execute() throws Exception { + public void execute() { setResult(callable.apply(getVariables())); } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskEvent.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskEvent.java index 7ee613a80..40a962639 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskEvent.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskEvent.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskExecutor.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskExecutor.java index 48adaccbd..c909427dc 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskExecutor.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskExecutor.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -17,10 +17,7 @@ */ package org.jackhuang.hmcl.task; -import org.jackhuang.hmcl.util.AutoTypingMap; -import org.jackhuang.hmcl.util.ExceptionalRunnable; -import org.jackhuang.hmcl.util.Lang; -import org.jackhuang.hmcl.util.Logging; +import org.jackhuang.hmcl.util.*; import java.util.*; import java.util.concurrent.ConcurrentLinkedQueue; @@ -38,7 +35,7 @@ import java.util.logging.Level; public final class TaskExecutor { private final Task firstTask; - private List taskListeners = new LinkedList<>(); + private final List taskListeners = new LinkedList<>(); private boolean canceled = false; private Exception lastException; private final AtomicInteger totTask = new AtomicInteger(0); @@ -83,7 +80,7 @@ public final class TaskExecutor { taskListeners.forEach(it -> it.onStop(flag.get(), this)); }); workerQueue.add(future); - Lang.invoke(() -> future.get()); + Lang.invoke((ExceptionalSupplier) future::get); return flag.get(); } @@ -184,7 +181,7 @@ public final class TaskExecutor { // do nothing } catch (Exception e) { lastException = e; - variables.set("lastException", e); + variables.set(LAST_EXCEPION_ID, e); Logging.LOG.log(Level.FINE, "Task failed: " + task.getName(), e); task.onDone().fireEvent(new TaskEvent(this, task, true)); taskListeners.forEach(it -> it.onFailed(task, e)); @@ -228,4 +225,6 @@ public final class TaskExecutor { } } + + public static final String LAST_EXCEPION_ID = "lastException"; } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskListener.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskListener.java index f5559a641..742b2e805 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskListener.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskListener.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskResult.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskResult.java index 8533e2352..7d7c1488e 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskResult.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/task/TaskResult.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/AutoTypingMap.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/AutoTypingMap.java index 1e3dfb602..c31d47537 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/AutoTypingMap.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/AutoTypingMap.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -35,7 +35,18 @@ public final class AutoTypingMap { this.impl = impl; } - public synchronized V get(K key) { + /** + * Get the value associated with given {@code key} in the mapping. + * + * Be careful of the return type {@code }, as you must ensure that {@code } is correct + * + * @param key the key that the value associated with + * @param the type of value which you must ensure type correction + * @return the value associated with given {@code key} + * @throws ClassCastException if the return type {@code } is incorrect. + */ + @SuppressWarnings("unchecked") + public synchronized V get(K key) throws ClassCastException { return (V) impl.get(key); } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Charsets.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Charsets.java index a45bec8cb..cdbc4b84d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Charsets.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Charsets.java @@ -1,6 +1,6 @@ /* * Hello Minecraft!. - * Copyright (C) 2013 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/CompressingUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/CompressingUtils.java index 21966c4c6..c3e1fc59b 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/CompressingUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/CompressingUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft!. - * Copyright (C) 2013 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -65,7 +65,7 @@ public final class CompressingUtils { * @param basePath the file directory to be compressed, if [src] is a file, this is the parent directory of [src] * @param zos the [ZipOutputStream] of dest zip file. * @param pathNameCallback callback(pathName, isDirectory) returns your modified pathName, null if you dont want this file zipped - * @throws IOException + * @throws IOException if an I/O error occurs. */ private static void zipFile(File src, String basePath, ZipArchiveOutputStream zos, BiFunction pathNameCallback) throws IOException { @@ -101,7 +101,7 @@ public final class CompressingUtils { * * @param src the input zip file. * @param dest the dest directory. - * @throws IOException + * @throws IOException if an I/O error occurs. */ public static void unzip(File src, File dest) throws IOException { unzip(src, dest, ""); @@ -113,7 +113,7 @@ public final class CompressingUtils { * @param src the input zip file. * @param dest the dest directory. * @param subDirectory the subdirectory of the zip file to be decompressed. - * @throws IOException + * @throws IOException if an I/O error occurs. */ public static void unzip(File src, File dest, String subDirectory) throws IOException { unzip(src, dest, subDirectory, null); @@ -126,7 +126,7 @@ public final class CompressingUtils { * @param dest the dest directory. * @param subDirectory the subdirectory of the zip file to be decompressed. * @param callback will be called for every entry in the zip file, returns false if you dont want this file being uncompressed. - * @throws IOException + * @throws IOException if an I/O error occurs. */ public static void unzip(File src, File dest, String subDirectory, Predicate callback) throws IOException { unzip(src, dest, subDirectory, callback, true); @@ -140,7 +140,7 @@ public final class CompressingUtils { * @param subDirectory the subdirectory of the zip file to be decompressed. * @param callback will be called for every entry in the zip file, returns false if you dont want this file being uncompressed. * @param ignoreExistentFile true if skip all existent files. - * @throws IOException + * @throws IOException if an I/O error occurs. */ public static void unzip(File src, File dest, String subDirectory, Predicate callback, boolean ignoreExistentFile) throws IOException { unzip(src, dest, subDirectory, callback, ignoreExistentFile, false); diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java index 5526708e6..fbd2e0724 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Constants.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -54,9 +54,7 @@ public final class Constants { public static final SimpleDateFormat DEFAULT_DATE_FORMAT = new SimpleDateFormat("HH:mm:ss"); - public static Consumer UI_THREAD_SCHEDULER = s -> { - Schedulers.computation().schedule(s::run); - }; + public static Consumer UI_THREAD_SCHEDULER = s -> Schedulers.computation().schedule(s::run); public static final Consumer SWING_UI_THREAD_SCHEDULER = s -> { if (EventQueue.isDispatchThread()) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DateTypeAdapter.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DateTypeAdapter.java index 008873114..61c876edd 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DateTypeAdapter.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DateTypeAdapter.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DigestUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DigestUtils.java index 217df8920..10d55f359 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DigestUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/DigestUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalConsumer.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalConsumer.java index f325b9438..8b8ea3643 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalConsumer.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalConsumer.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalFunction.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalFunction.java index 008b84d57..2aef6f7cd 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalFunction.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalFunction.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalRunnable.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalRunnable.java index 22a07c84f..941b8cbb2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalRunnable.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalRunnable.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalSupplier.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalSupplier.java index b679bfa5d..96be114c3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalSupplier.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ExceptionalSupplier.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileTypeAdapter.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileTypeAdapter.java index 4da93dd0d..503ead9b2 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileTypeAdapter.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileTypeAdapter.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileUtils.java index 5679e6cfc..9004b92b7 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/FileUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -214,7 +214,7 @@ public final class FileUtils { public static void copyFileQuietly(File srcFile, File destFile) { try { copyFile(srcFile, destFile); - } catch (IOException ex) { + } catch (IOException ignore) { } } @@ -251,9 +251,7 @@ public final class FileUtils { } public static boolean makeFile(File file) { - if (!makeDirectory(file.getAbsoluteFile().getParentFile())) - return false; - return file.exists() || Lang.test(file::createNewFile); + return makeDirectory(file.getAbsoluteFile().getParentFile()) && (file.exists() || Lang.test(file::createNewFile)); } public static List listFilesByExtension(File file, String extension) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Hex.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Hex.java index d3fc7ebb7..892748273 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Hex.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Hex.java @@ -1,6 +1,6 @@ /* * Hello Minecraft!. - * Copyright (C) 2013 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IOUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IOUtils.java index 7900118e9..df17e944c 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IOUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IOUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateBooleanProperty.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateBooleanProperty.java index 54ca83039..3575d3fed 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateBooleanProperty.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateBooleanProperty.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -48,20 +48,32 @@ public class ImmediateBooleanProperty extends SimpleBooleanProperty { super.unbind(); } - private Consumer listener = Constants.emptyConsumer(); - private final ChangeListener changeListener = (a, b, newValue) -> listener.accept(newValue); + private Consumer consumer = null; + private ChangeListener listener = null; - public void setChangedListener(Consumer listener) { + public void setChangedListener(Consumer consumer) { + this.consumer = Objects.requireNonNull(consumer); + this.listener = null; + } + + public void setChangedListener(ChangeListener listener) { + this.consumer = null; this.listener = Objects.requireNonNull(listener); } public void setChangedListenerAndOperate(Consumer listener) { - this.listener = Objects.requireNonNull(listener); + setChangedListener(listener); listener.accept(get()); } public ImmediateBooleanProperty(Object bean, String name, boolean initialValue) { super(bean, name, initialValue); + ChangeListener changeListener = (a, b, newValue) -> { + if (consumer != null) + consumer.accept(newValue); + if (listener != null) + listener.changed(a, b, newValue); + }; addListener(changeListener); } } \ No newline at end of file diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateDoubleProperty.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateDoubleProperty.java index f6937c132..a2014317f 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateDoubleProperty.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateDoubleProperty.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -49,15 +49,32 @@ public class ImmediateDoubleProperty extends SimpleDoubleProperty { super.unbind(); } - private Consumer listener = Constants.emptyConsumer(); - private final ChangeListener changeListener = (a, b, newValue) -> listener.accept(newValue.doubleValue()); + private Consumer consumer = null; + private ChangeListener listener = null; - public void setChangedListener(Consumer listener) { + public void setChangedListener(Consumer consumer) { + this.consumer = Objects.requireNonNull(consumer); + this.listener = null; + } + + public void setChangedListener(ChangeListener listener) { + this.consumer = null; this.listener = Objects.requireNonNull(listener); } + public void setChangedListenerAndOperate(Consumer listener) { + setChangedListener(listener); + listener.accept(get()); + } + public ImmediateDoubleProperty(Object bean, String name, double initialValue) { super(bean, name, initialValue); + ChangeListener changeListener = (a, b, newValue) -> { + if (consumer != null) + consumer.accept(newValue.doubleValue()); + if (listener != null) + listener.changed(a, b, newValue); + }; addListener(changeListener); } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateIntegerProperty.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateIntegerProperty.java index 49c4dea81..d1b1ae0d3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateIntegerProperty.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateIntegerProperty.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -48,15 +48,32 @@ public class ImmediateIntegerProperty extends SimpleIntegerProperty { super.unbind(); } - private Consumer listener = Constants.emptyConsumer(); - private final ChangeListener changeListener = (a, b, newValue) -> listener.accept(newValue.intValue()); + private Consumer consumer = null; + private ChangeListener listener = null; - public void setChangedListener(Consumer listener) { + public void setChangedListener(Consumer consumer) { + this.consumer = Objects.requireNonNull(consumer); + this.listener = null; + } + + public void setChangedListener(ChangeListener listener) { + this.consumer = null; this.listener = Objects.requireNonNull(listener); } + public void setChangedListenerAndOperate(Consumer listener) { + setChangedListener(listener); + listener.accept(get()); + } + public ImmediateIntegerProperty(Object bean, String name, int initialValue) { super(bean, name, initialValue); + ChangeListener changeListener = (a, b, newValue) -> { + if (consumer != null) + consumer.accept(newValue.intValue()); + if (listener != null) + listener.changed(a, b, newValue); + }; addListener(changeListener); } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateObjectProperty.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateObjectProperty.java index d18f2c559..42ff4d498 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateObjectProperty.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateObjectProperty.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -48,20 +48,32 @@ public class ImmediateObjectProperty extends SimpleObjectProperty { super.unbind(); } - private Consumer listener = Constants.emptyConsumer(); - private final ChangeListener changeListener = (a, b, newValue) -> listener.accept(newValue); + private Consumer consumer = null; + private ChangeListener listener = null; - public void setChangedListener(Consumer listener) { + public void setChangedListener(Consumer consumer) { + this.consumer = Objects.requireNonNull(consumer); + this.listener = null; + } + + public void setChangedListener(ChangeListener listener) { + this.consumer = null; this.listener = Objects.requireNonNull(listener); } public void setChangedListenerAndOperate(Consumer listener) { - this.listener = Objects.requireNonNull(listener); + setChangedListener(listener); listener.accept(get()); } public ImmediateObjectProperty(Object bean, String name, T initialValue) { super(bean, name, initialValue); + ChangeListener changeListener = (a, b, newValue) -> { + if (consumer != null) + consumer.accept(newValue); + if (listener != null) + listener.changed(a, b, newValue); + }; addListener(changeListener); } } \ No newline at end of file diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateStringProperty.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateStringProperty.java index 5b0a2d02c..567385b67 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateStringProperty.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ImmediateStringProperty.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -50,12 +50,6 @@ public class ImmediateStringProperty extends SimpleStringProperty { private Consumer consumer = null; private ChangeListener listener = null; - private final ChangeListener changeListener = (a, b, newValue) -> { - if (consumer != null) - consumer.accept(newValue); - if (listener != null) - listener.changed(a, b, newValue); - }; public void setChangedListener(Consumer consumer) { this.consumer = Objects.requireNonNull(consumer); @@ -69,6 +63,12 @@ public class ImmediateStringProperty extends SimpleStringProperty { public ImmediateStringProperty(Object bean, String name, String initialValue) { super(bean, name, initialValue); + ChangeListener changeListener = (a, b, newValue) -> { + if (consumer != null) + consumer.accept(newValue); + if (listener != null) + listener.changed(a, b, newValue); + }; addListener(changeListener); } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Immutable.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Immutable.java index 094f2032e..a79c751e9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Immutable.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Immutable.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IntVersionNumber.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IntVersionNumber.java index 4f8128f64..c96425e11 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IntVersionNumber.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/IntVersionNumber.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JavaVersion.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JavaVersion.java index 795a6f22a..29640cb70 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JavaVersion.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JavaVersion.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -179,7 +179,7 @@ public final class JavaVersion implements Serializable { javaVersions = queryMacintosh(); break; default: - javaVersions = Collections.EMPTY_LIST; + javaVersions = Collections.emptyList(); break; } for (JavaVersion v : javaVersions) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JsonUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JsonUtils.java index de5fe0a0b..9ff421ddc 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JsonUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/JsonUtils.java @@ -1,7 +1,27 @@ +/* + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.util; import com.google.gson.JsonParseException; +/** + * @author yushijinhun + */ public final class JsonUtils { private JsonUtils() {} diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Lang.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Lang.java index f96ec0dc9..68a4fb4f0 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Lang.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Lang.java @@ -1,7 +1,19 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Hello Minecraft! Launcher. + * Copyright (C) 2018 huangyuhui + * + * 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.hmcl.util; diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Log4jLevel.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Log4jLevel.java index 65932914c..98145f463 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Log4jLevel.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Log4jLevel.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Logging.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Logging.java index 5e3512772..d95c4f95a 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Logging.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Logging.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/LowerCaseEnumTypeAdapterFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/LowerCaseEnumTypeAdapterFactory.java index a31a8d038..1cdbc0229 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/LowerCaseEnumTypeAdapterFactory.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/LowerCaseEnumTypeAdapterFactory.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -26,6 +26,7 @@ import com.google.gson.stream.JsonToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.Arrays; import java.util.HashMap; import java.util.Locale; @@ -38,6 +39,7 @@ public final class LowerCaseEnumTypeAdapterFactory implements TypeAdapterFactory public static final LowerCaseEnumTypeAdapterFactory INSTANCE = new LowerCaseEnumTypeAdapterFactory(); @Override + @SuppressWarnings("unchecked") public TypeAdapter create(Gson gson, TypeToken tt) { Class rawType = tt.getRawType(); if (!rawType.isEnum()) diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ManagedProcess.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ManagedProcess.java index b32d58baa..564fdc808 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ManagedProcess.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ManagedProcess.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/NetworkUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/NetworkUtils.java index 98806ad3e..e747bd638 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/NetworkUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/NetworkUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/OperatingSystem.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/OperatingSystem.java index 70389422f..d84670492 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/OperatingSystem.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/OperatingSystem.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Pair.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Pair.java index e7b2ce92d..698a50514 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Pair.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Pair.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -72,9 +72,7 @@ public class Pair implements Map.Entry { if (getClass() != obj.getClass()) return false; final Pair other = (Pair) obj; - if (!Objects.equals(this.key, other.key)) - return false; - return Objects.equals(this.value, other.value); + return Objects.equals(this.key, other.key) && Objects.equals(this.value, other.value); } @Override diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Platform.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Platform.java index 012650951..d0eed274d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Platform.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Platform.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Properties.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Properties.java index f88b7203a..44bc547bc 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Properties.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Properties.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -32,8 +32,7 @@ public final class Properties { public static void updateAsync(Property property, T newValue, AtomicReference update) { if (update.getAndSet(newValue) == null) - Constants.UI_THREAD_SCHEDULER.accept(() -> { - property.setValue(update.getAndSet(null)); - }); + Constants.UI_THREAD_SCHEDULER.accept(() -> + property.setValue(update.getAndSet(null))); } } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ReflectionHelper.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ReflectionHelper.java index 3fb336020..ad90e0ac3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ReflectionHelper.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ReflectionHelper.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/SimpleMultimap.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/SimpleMultimap.java index 9f83dc2c8..a90060172 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/SimpleMultimap.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/SimpleMultimap.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringUtils.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringUtils.java index 961705aa9..bc1a17cda 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringUtils.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringUtils.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -59,9 +59,8 @@ public final class StringUtils { else cmdbuf.append(s); } - String str = cmdbuf.toString(); - return str; + return cmdbuf.toString(); } public static String getStackTrace(Throwable throwable) { diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringVersionNumber.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringVersionNumber.java index 942ef6f58..9a06d4dcb 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringVersionNumber.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/StringVersionNumber.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ToStringBuilder.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ToStringBuilder.java index 29135510f..bc9243ab9 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ToStringBuilder.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ToStringBuilder.java @@ -12,6 +12,7 @@ public class ToStringBuilder { public ToStringBuilder append(String name, Object content) { if (!first) stringBuilder.append(", "); + first = false; stringBuilder.append(name).append('=').append(content.toString()); return this; } diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/UUIDTypeAdapter.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/UUIDTypeAdapter.java index 193b9db0c..1fc14a1d8 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/UUIDTypeAdapter.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/UUIDTypeAdapter.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Validation.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Validation.java index 8dba5b3c4..3bc9bbc91 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Validation.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/Validation.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ValidationTypeAdapterFactory.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ValidationTypeAdapterFactory.java index c64f20cd6..856b8552d 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ValidationTypeAdapterFactory.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ValidationTypeAdapterFactory.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/VersionNumber.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/VersionNumber.java index 22e5c8717..d9fefc1f3 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/VersionNumber.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/VersionNumber.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 diff --git a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ZipEngine.java b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ZipEngine.java index b844247e9..ba11d3712 100644 --- a/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ZipEngine.java +++ b/HMCLCore/src/main/java/org/jackhuang/hmcl/util/ZipEngine.java @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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 @@ -29,9 +29,9 @@ import java.util.zip.ZipOutputStream; * * @author huangyuhui */ -public class ZipEngine implements Closeable { +public final class ZipEngine implements Closeable { - byte[] buf = new byte[IOUtils.DEFAULT_BUFFER_SIZE]; + private final byte[] buf = new byte[IOUtils.DEFAULT_BUFFER_SIZE]; ZipOutputStream zos; public ZipEngine(File f) throws IOException { @@ -122,7 +122,7 @@ public class ZipEngine implements Closeable { putStream(new ByteArrayInputStream(text.getBytes(encoding)), pathName); } - protected HashSet names = new HashSet<>(); + private final HashSet names = new HashSet<>(); public void put(ZipEntry entry) throws IOException { if (names.add(entry.getName())) diff --git a/LICENSE b/LICENSE index 711fa7b61..e8a8b24cf 100644 --- a/LICENSE +++ b/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Hello Minecraft! Launcher, a Minecraft Launcher which is easy to use. - Copyright (C) 2014 huangyuhui + Copyright (C) 2018 huangyuhui 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 @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Hello Minecraft! Launcher Copyright (C) 2014 huangyuhui + Hello Minecraft! Launcher Copyright (C) 2018 huangyuhui This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/build.gradle b/build.gradle index 92f3ec1c8..4aef48a72 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ /* * Hello Minecraft! Launcher. - * Copyright (C) 2017 huangyuhui + * Copyright (C) 2018 huangyuhui * * 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