Add --proxy
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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
|
||||
build.dependsOn makeExecutable
|
||||
|
||||
@@ -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<String> 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 {
|
||||
|
||||
@@ -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(" ")));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -120,8 +120,9 @@ public final class Config {
|
||||
}
|
||||
|
||||
public TreeMap<String, Profile> getConfigurations() {
|
||||
if (configurations == null) {
|
||||
if (configurations == null)
|
||||
configurations = new TreeMap<>();
|
||||
if (configurations.isEmpty()) {
|
||||
Profile profile = new Profile();
|
||||
configurations.put(profile.getName(), profile);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public final class OfflineAuthenticator extends IAuthenticator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidePasswordBox() {
|
||||
public boolean hasPassword() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<InstallerVersionList.InstallerVersion> 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<InstallerVersionList.InstallerVersion> 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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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 {
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Loads">
|
||||
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 {
|
||||
//</editor-fold>
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="Private Variables">
|
||||
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")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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
|
||||
build.dependsOn makeExecutable
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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'
|
||||
|
||||
|
||||
15
build.gradle
15
build.gradle
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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.*
|
||||
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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'
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
* Hello Minecraft! Launcher.
|
||||
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||
*
|
||||
* 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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user