From 78c46aeb64f1a559d9197815552248575c7ec0a6 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Thu, 10 Dec 2015 20:34:02 +0800 Subject: [PATCH] Add --proxy --- HMCL/build.gradle | 21 ++--- .../hellominecraft/launcher/Launcher.java | 31 +++++++- .../launch/AbstractMinecraftLoader.java | 9 +++ .../launcher/launch/MinecraftLoader.java | 1 - .../launcher/settings/Config.java | 3 +- .../launcher/utils/auth/IAuthenticator.java | 4 +- .../utils/auth/OfflineAuthenticator.java | 2 +- .../launcher/views/GameSettingsPanel.java | 78 ++++++------------- .../launcher/views/LauncherSettingsPanel.java | 7 +- .../launcher/views/MainPagePanel.java | 22 +++--- HMCLAPI/build.gradle | 17 ++-- HMCSM/build.gradle | 17 ++-- MetroLookAndFeel/build.gradle | 15 ++-- build.gradle | 15 ++-- common.gradle | 15 ++-- settings.gradle | 15 ++-- 16 files changed, 144 insertions(+), 128 deletions(-) diff --git a/HMCL/build.gradle b/HMCL/build.gradle index c969403af..8fccbba1d 100644 --- a/HMCL/build.gradle +++ b/HMCL/build.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ import java.util.jar.JarOutputStream import java.util.zip.ZipEntry @@ -25,7 +26,7 @@ if (!hasProperty('mainClass')) { ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main' } -def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".5" : "."+System.getenv("BUILD_NUMBER") +def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".6" : "."+System.getenv("BUILD_NUMBER") String mavenGroupId = 'HMCL' String mavenVersion = '2.3.5' + buildnumber @@ -73,7 +74,7 @@ jar { from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } manifest { - attributes 'Created-By' : 'Copyright(c) 2013-2014 huangyuhui.', + attributes 'Created-By' : 'Copyright(c) 2013-2016 huangyuhui.', 'Main-Class' : mainClass } } @@ -100,4 +101,4 @@ processResources { } } -build.dependsOn makeExecutable \ No newline at end of file +build.dependsOn makeExecutable diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Launcher.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Launcher.java index 6355731b7..3e4922e53 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Launcher.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Launcher.java @@ -20,16 +20,20 @@ package org.jackhuang.hellominecraft.launcher; import java.io.File; import java.io.FileOutputStream; import java.lang.reflect.Method; +import java.net.Authenticator; +import java.net.PasswordAuthentication; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import javax.swing.SwingUtilities; import org.jackhuang.hellominecraft.C; +import org.jackhuang.hellominecraft.HMCLog; import org.jackhuang.hellominecraft.utils.StrUtils; import org.jackhuang.hellominecraft.views.LogWindow; import org.jackhuang.hellominecraft.launcher.launch.MinecraftCrashAdvicer; import org.jackhuang.hellominecraft.utils.DoubleOutputStream; import org.jackhuang.hellominecraft.utils.LauncherPrintStream; +import org.jackhuang.hellominecraft.utils.MathUtils; import org.jackhuang.hellominecraft.utils.MessageBox; import org.jackhuang.hellominecraft.utils.Utils; @@ -42,12 +46,13 @@ public final class Launcher { public static void println(String s) { System.out.println(s); } + + static String classPath = "", proxyHost = "", proxyPort = "", proxyUsername = "", proxyPassword = ""; public static void main(String[] args) { println("*** " + Main.makeTitle() + " ***"); boolean showInfo = false; - String classPath = ""; String mainClass = "net.minecraft.client.Minecraft"; ArrayList cmdList = new ArrayList<>(); @@ -57,6 +62,14 @@ public final class Launcher { classPath = classPath.concat(s.substring("-cp=".length())); else if (s.startsWith("-mainClass=")) mainClass = s.substring("-mainClass=".length()); + else if (s.startsWith("-proxyHost=")) + proxyHost = s.substring("-proxyHost=".length()); + else if (s.startsWith("-proxyPort=")) + proxyPort = s.substring("-proxyPort=".length()); + else if (s.startsWith("-proxyUsername=")) + proxyUsername = s.substring("-proxyUsername=".length()); + else if (s.startsWith("-proxyPassword=")) + proxyPassword = s.substring("-proxyPassword=".length()); else if (s.equals("-debug")) showInfo = true; else @@ -87,6 +100,22 @@ public final class Launcher { SwingUtilities.invokeLater(() -> LogWindow.INSTANCE.setVisible(true)); } + if (StrUtils.isNotBlank(proxyHost) && StrUtils.isNotBlank(proxyPort) && MathUtils.canParseInt(proxyPort)) { + HMCLog.log("Initializing customized proxy"); + System.setProperty("http.proxyHost", proxyHost); + System.setProperty("http.proxyPort", proxyPort); + if (StrUtils.isNotBlank(proxyUsername) && StrUtils.isNotBlank(proxyPassword)) + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(proxyUsername, proxyPassword.toCharArray()); + } + }); + //PROXY = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Settings.getInstance().getProxyHost(), Integer.parseInt(Settings.getInstance().getProxyPort()))); + } else { + //PROXY = Proxy.NO_PROXY; + } + URL[] urls = new URL[len]; try { diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/AbstractMinecraftLoader.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/AbstractMinecraftLoader.java index fd90ae68b..38b96de3c 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/AbstractMinecraftLoader.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/AbstractMinecraftLoader.java @@ -173,6 +173,15 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader { if (v.isDebug() && !v.isCanceledWrapper()) res.add("-debug"); + if (StrUtils.isNotBlank(Settings.getInstance().getProxyHost()) && StrUtils.isNotBlank(Settings.getInstance().getProxyPort()) && MathUtils.canParseInt(Settings.getInstance().getProxyPort())) { + res.add("-proxyHost=" + Settings.getInstance().getProxyHost()); + res.add("-proxyPort=" + Settings.getInstance().getProxyPort()); + if (StrUtils.isNotBlank(Settings.getInstance().getProxyUserName()) && StrUtils.isNotBlank(Settings.getInstance().getProxyPassword())) { + res.add("-proxyUsername=" + Settings.getInstance().getProxyUserName()); + res.add("-proxyPassword=" + Settings.getInstance().getProxyPassword()); + } + } + if (StrUtils.isNotBlank(v.getMinecraftArgs())) res.addAll(Arrays.asList(v.getMinecraftArgs().split(" "))); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java index abd7df537..052a7621b 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/launch/MinecraftLoader.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; -import javax.swing.SwingUtilities; import org.jackhuang.hellominecraft.C; import org.jackhuang.hellominecraft.HMCLog; import org.jackhuang.hellominecraft.launcher.utils.auth.UserProfileProvider; diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java index 0a1d2bef1..b27cf5e9a 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/settings/Config.java @@ -120,8 +120,9 @@ public final class Config { } public TreeMap getConfigurations() { - if (configurations == null) { + if (configurations == null) configurations = new TreeMap<>(); + if (configurations.isEmpty()) { Profile profile = new Profile(); configurations.put(profile.getName(), profile); } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/IAuthenticator.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/IAuthenticator.java index 5530933a2..fe44543f6 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/IAuthenticator.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/IAuthenticator.java @@ -72,9 +72,9 @@ public abstract class IAuthenticator { /** * Has password? * - * @return Will I hide password box? + * @return Need to hide password box? */ - public boolean isHidePasswordBox() { + public boolean hasPassword() { return false; } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/OfflineAuthenticator.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/OfflineAuthenticator.java index d68b951dd..b31ae0025 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/OfflineAuthenticator.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/utils/auth/OfflineAuthenticator.java @@ -55,7 +55,7 @@ public final class OfflineAuthenticator extends IAuthenticator { } @Override - public boolean isHidePasswordBox() { + public boolean hasPassword() { return true; } diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java index d0f2917a8..5b5f39141 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/GameSettingsPanel.java @@ -105,16 +105,15 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT ppmExplore = new JPopupMenu(); class ImplementedActionListener implements ActionListener { + String a; + ImplementedActionListener(String s) { a = s; } - String a; @Override public void actionPerformed(ActionEvent e) { - Profile v = getProfile(); - if (v != null) - v.getMinecraftProvider().open(mcVersion, a); + getProfile().getMinecraftProvider().open(mcVersion, a); } } JMenuItem itm; @@ -142,35 +141,31 @@ public final class GameSettingsPanel extends javax.swing.JPanel implements DropT ppmManage = new JPopupMenu(); JMenuItem itm = new JMenuItem(C.i18n("versions.manage.rename")); itm.addActionListener((e) -> { - Profile v = getProfile(); - if (v != null && mcVersion != null) { + if (mcVersion != null) { String newName = JOptionPane.showInputDialog(C.i18n("versions.manage.rename.message"), mcVersion); if (newName != null) - if (v.getMinecraftProvider().renameVersion(mcVersion, newName)) + if (getProfile().getMinecraftProvider().renameVersion(mcVersion, newName)) refreshVersions(); } }); ppmManage.add(itm); itm = new JMenuItem(C.i18n("versions.manage.remove")); itm.addActionListener((e) -> { - Profile v = getProfile(); - if (v != null && mcVersion != null && MessageBox.Show(C.i18n("versions.manage.remove.confirm") + mcVersion, MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) - if (v.getMinecraftProvider().removeVersionFromDisk(mcVersion)) + if (mcVersion != null && MessageBox.Show(C.i18n("versions.manage.remove.confirm") + mcVersion, MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) + if (getProfile().getMinecraftProvider().removeVersionFromDisk(mcVersion)) refreshVersions(); }); ppmManage.add(itm); itm = new JMenuItem(C.i18n("versions.manage.redownload_json")); itm.addActionListener((e) -> { - Profile v = getProfile(); - if (v != null && mcVersion != null) - v.getMinecraftProvider().refreshJson(mcVersion); + if (mcVersion != null) + getProfile().getMinecraftProvider().refreshJson(mcVersion); }); ppmManage.add(itm); itm = new JMenuItem(C.i18n("versions.manage.redownload_assets_index")); itm.addActionListener((e) -> { - Profile v = getProfile(); - if (v != null && mcVersion != null) - v.getMinecraftProvider().getAssetService().refreshAssetsIndex(mcVersion); + if (mcVersion != null) + getProfile().getMinecraftProvider().getAssetService().refreshAssetsIndex(mcVersion); }); ppmManage.add(itm); } @@ -1126,19 +1121,18 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_btnNewProfileActionPerformed private void btnRemoveProfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveProfileActionPerformed - if (getProfile() == null) - return; if (MessageBox.Show(C.i18n("ui.message.sure_remove", getProfile().getName()), MessageBox.YES_NO_OPTION) == MessageBox.NO_OPTION) return; + String name = getProfile().getName(); if (Settings.delProfile(getProfile())) { - cboProfiles.removeItem(getProfile().getName()); + cboProfiles.removeItem(name); prepare(getProfile()); loadVersions(); } }//GEN-LAST:event_btnRemoveProfileActionPerformed private void cboVersionsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboVersionsItemStateChanged - if (isLoading || evt.getStateChange() != ItemEvent.SELECTED || cboVersions.getSelectedIndex() < 0 || StrUtils.isBlank((String) cboVersions.getSelectedItem()) || getProfile() == null) + if (isLoading || evt.getStateChange() != ItemEvent.SELECTED || cboVersions.getSelectedIndex() < 0 || StrUtils.isBlank((String) cboVersions.getSelectedItem())) return; String mcv = (String) cboVersions.getSelectedItem(); loadMinecraftVersion(mcv); @@ -1252,7 +1246,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_cboLauncherVisibilityFocusLost private void btnDownloadAllAssetsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadAllAssetsActionPerformed - if (mcVersion != null && getProfile() != null) + if (mcVersion != null) getProfile().getMinecraftProvider().getAssetService().downloadAssets(mcVersion).run(); }//GEN-LAST:event_btnDownloadAllAssetsActionPerformed @@ -1277,8 +1271,6 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_txtWidthFocusLost private void txtGameDirFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtGameDirFocusLost - if (getProfile() == null) - return; getProfile().setGameDir(txtGameDir.getText()); loadVersions(); }//GEN-LAST:event_txtGameDirFocusLost @@ -1307,7 +1299,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { }//GEN-LAST:event_btnChoosingJavaDirActionPerformed private void cboJavaItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboJavaItemStateChanged - if (isLoading || evt.getStateChange() != ItemEvent.SELECTED || cboJava.getSelectedIndex() < 0 || StrUtils.isBlank((String) cboJava.getSelectedItem()) || getProfile() == null) + if (isLoading || evt.getStateChange() != ItemEvent.SELECTED || cboJava.getSelectedIndex() < 0 || StrUtils.isBlank((String) cboJava.getSelectedItem())) return; int idx = cboJava.getSelectedIndex(); if (idx != -1) { @@ -1325,11 +1317,11 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { fc.setMultiSelectionEnabled(true); if (fc.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) return; - boolean flag = false; + boolean flag = true; for (File f : fc.getSelectedFiles()) - flag |= !getProfile().getMinecraftProvider().getModService().addMod(f); + flag &= getProfile().getMinecraftProvider().getModService().addMod(f); reloadMods(); - if (flag) + if (!flag) MessageBox.Show(C.I18N.getString("mods.failed")); }//GEN-LAST:event_btnAddModActionPerformed @@ -1384,20 +1376,13 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { private void loadProfiles() { isLoading = true; cboProfiles.removeAllItems(); - Profile firstProfile = null, selectedProfile = null; int index = 0, i = 0; for (Profile s : Settings.getProfilesFiltered()) { - if (firstProfile == null) - firstProfile = s; cboProfiles.addItem(s.getName()); - if (Settings.getInstance().getLast() != null && Settings.getInstance().getLast().equals(s.getName())) { + if (Settings.getInstance().getLast() != null && Settings.getInstance().getLast().equals(s.getName())) index = i; - selectedProfile = s; - } i++; } - if (selectedProfile == null) - selectedProfile = Settings.getOneProfile(); isLoading = false; if (index < cboProfiles.getItemCount()) { @@ -1408,10 +1393,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { } final Profile getProfile() { - if (cboProfiles.getSelectedIndex() >= 0) - return Settings.getProfile(cboProfiles.getSelectedItem().toString()); - else - return Settings.getProfile(null); + return Settings.getProfile((String) cboProfiles.getSelectedItem()); } void prepare(Profile profile) { @@ -1444,8 +1426,6 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { } void loadVersions() { - if (getProfile() == null) - return; isLoading = true; cboVersions.removeAllItems(); int index = 0, i = 0; @@ -1502,7 +1482,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { } void downloadMinecraft() { - if (getProfile() == null || lstDownloads.getSelectedRow() < 0) { + if (lstDownloads.getSelectedRow() < 0) { MessageBox.Show(C.i18n("gamedownload.not_refreshed")); return; } @@ -1586,18 +1566,12 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { private List loadVersions(InstallerVersionList list, JTable table) { if (list == null) return null; - DefaultTableModel model = (DefaultTableModel) table.getModel(); - while (model.getRowCount() > 0) - model.removeRow(0); + DefaultTableModel model = SwingUtils.clearDefaultTable(table); String mcver = StrUtils.formatVersion(getMinecraftVersionFormatted()); List ver = list.getVersions(mcver); if (ver != null) { - for (InstallerVersionList.InstallerVersion v : ver) { - Object a = v.selfVersion == null ? "null" : v.selfVersion; - Object b = v.mcVersion == null ? "null" : v.mcVersion; - Object[] row = new Object[] {a, b}; - model.addRow(row); - } + for (InstallerVersionList.InstallerVersion v : ver) + model.addRow(new Object[] {v.selfVersion == null ? "null" : v.selfVersion, v.mcVersion == null ? "null" : v.mcVersion}); table.updateUI(); } return ver; @@ -1634,8 +1608,6 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() { public void onSelected() { loadProfiles(); - if (getProfile() == null) - return; if (getProfile().getMinecraftProvider().getVersionCount() <= 0) versionChanged(null); else diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/LauncherSettingsPanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/LauncherSettingsPanel.java index 0d635b76f..6bc1275e2 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/LauncherSettingsPanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/LauncherSettingsPanel.java @@ -28,6 +28,7 @@ import org.jackhuang.hellominecraft.launcher.settings.Settings; import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType; import org.jackhuang.hellominecraft.utils.system.IOUtils; import org.jackhuang.hellominecraft.utils.MessageBox; +import rx.Observable; /** * @@ -41,10 +42,8 @@ public class LauncherSettingsPanel extends javax.swing.JPanel { public LauncherSettingsPanel() { initComponents(); - String[] strings = new String[DownloadType.values().length]; - for (int i = 0; i < strings.length; i++) - strings[i] = DownloadType.values()[i].getName(); - cboDownloadSource.setModel(new DefaultComboBoxModel(strings)); + Observable.from(DownloadType.values()).map(t -> t.getName()).toList() + .subscribe(t -> cboDownloadSource.setModel(new DefaultComboBoxModel(t.toArray(new String[0])))); txtBackgroundPath.setText(Settings.getInstance().getBgpath()); txtProxyHost.setText(Settings.getInstance().getProxyHost()); diff --git a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainPagePanel.java b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainPagePanel.java index 497a7edc3..924f762fd 100644 --- a/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainPagePanel.java +++ b/HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/views/MainPagePanel.java @@ -276,14 +276,14 @@ public class MainPagePanel extends javax.swing.JPanel { }//GEN-LAST:event_txtPlayerNameFocusLost private void cboLoginModeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboLoginModeItemStateChanged - if (preaparingAuth) + if (preparingAuth) return; int index = cboLoginMode.getSelectedIndex(); if (index < 0) return; IAuthenticator l = IAuthenticator.LOGINS.get(index); - if (l.isHidePasswordBox()) { + if (l.hasPassword()) { pnlPassword.setVisible(false); lblUserName.setText(C.i18n("login.username")); } else { @@ -327,7 +327,7 @@ public class MainPagePanel extends javax.swing.JPanel { }//GEN-LAST:event_txtPasswordActionPerformed private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogoutActionPerformed - if (preaparingAuth) + if (preparingAuth) return; int index = cboLoginMode.getSelectedIndex(); @@ -345,7 +345,7 @@ public class MainPagePanel extends javax.swing.JPanel { if (index < 0) return; IAuthenticator l = IAuthenticator.LOGINS.get(index); - if (l.isHidePasswordBox()) + if (l.hasPassword()) btnRunActionPerformed(); else if (!l.isLoggedIn()) txtPassword.requestFocus(); @@ -385,7 +385,7 @@ public class MainPagePanel extends javax.swing.JPanel { return; } final IAuthenticator l = IAuthenticator.LOGINS.get(index); - final LoginInfo li = new LoginInfo(Settings.getInstance().getUsername(), l.isLoggedIn() || l.isHidePasswordBox() ? null : new String(txtPassword.getPassword())); + final LoginInfo li = new LoginInfo(Settings.getInstance().getUsername(), l.isLoggedIn() || l.hasPassword() ? null : new String(txtPassword.getPassword())); new Thread() { @Override public void run() { @@ -411,7 +411,7 @@ public class MainPagePanel extends javax.swing.JPanel { // private void prepareAuths() { - preaparingAuth = true; + preparingAuth = true; cboLoginMode.removeAllItems(); for (IAuthenticator str : IAuthenticator.LOGINS) try { @@ -421,7 +421,7 @@ public class MainPagePanel extends javax.swing.JPanel { } int loginType = Settings.getInstance().getLoginType(); if (0 <= loginType && loginType < cboLoginMode.getItemCount()) { - preaparingAuth = false; + preparingAuth = false; //cboLoginMode.setSelectedIndex(loginType); @@ -486,7 +486,7 @@ public class MainPagePanel extends javax.swing.JPanel { // // - boolean preaparingAuth = true; + boolean preparingAuth = true; private boolean isLoading = false; private final javax.swing.JPanel pnlButtons; private final ConstomButton btnRun; @@ -518,12 +518,12 @@ public class MainPagePanel extends javax.swing.JPanel { }); } - public void onShow(boolean showLeft) { - if (showLeft) + public void onShow(boolean showFirstLoadingMessage) { + if (showFirstLoadingMessage) SwingUtilities.invokeLater(() -> MainFrame.INSTANCE.showMessage(C.i18n("ui.message.first_load"))); if (cboLoginMode.getSelectedIndex() >= 0 && cboLoginMode.getSelectedIndex() < cboLoginMode.getItemCount()) { IAuthenticator l = IAuthenticator.LOGINS.get(cboLoginMode.getSelectedIndex()); - if (!l.isHidePasswordBox() && !l.isLoggedIn()) + if (!l.hasPassword() && !l.isLoggedIn()) SwingUtilities.invokeLater(() -> MainFrame.INSTANCE.showMessage(C.i18n("ui.message.enter_password"))); } } diff --git a/HMCLAPI/build.gradle b/HMCLAPI/build.gradle index f960a8de3..7c2a1b656 100644 --- a/HMCLAPI/build.gradle +++ b/HMCLAPI/build.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ apply plugin: 'me.tatarka.retrolambda' @@ -35,4 +36,4 @@ buildscript { retrolambda { javaVersion = JavaVersion.VERSION_1_6 -} \ No newline at end of file +} diff --git a/HMCSM/build.gradle b/HMCSM/build.gradle index 491dab4c6..ffc3583f7 100644 --- a/HMCSM/build.gradle +++ b/HMCSM/build.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ apply plugin: 'launch4j' apply plugin: 'me.tatarka.retrolambda' @@ -77,4 +78,4 @@ processResources { } } -build.dependsOn makeExecutable \ No newline at end of file +build.dependsOn makeExecutable diff --git a/MetroLookAndFeel/build.gradle b/MetroLookAndFeel/build.gradle index 8ac58d8e4..455d5fdc3 100644 --- a/MetroLookAndFeel/build.gradle +++ b/MetroLookAndFeel/build.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ apply plugin: 'me.tatarka.retrolambda' diff --git a/build.gradle b/build.gradle index 8b170a97c..e38604c34 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ import org.gradle.api.artifacts.* diff --git a/common.gradle b/common.gradle index 114bf6d88..7a035fc7e 100644 --- a/common.gradle +++ b/common.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ apply plugin: 'java' apply plugin: 'maven' diff --git a/settings.gradle b/settings.gradle index 4d333bb76..3cd87598c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,18 +1,19 @@ /* - * Copyright 2013 huangyuhui + * Hello Minecraft! Launcher. + * Copyright (C) 2013 huangyuhui * - * This program is free software; you can redistribute it and/or modify + * This 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 2 of the License, or + * 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 + * 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. + * along with this program. If not, see {http://www.gnu.org/licenses/}. */ rootProject.name = 'HMCL'