Compare commits

...
3 Commits
60 ... 62
Author SHA1 Message Date
huanghongxun 88194e479e Update README.md 2016-06-07 23:00:07 +08:00
huangyuhui b36c194f67 Merge branch 'master' of https://github.com/huanghongxun/HMCL 2016-05-28 23:19:21 +08:00
huangyuhui 7c7b6e0fd9 Fixed #73 2016-05-28 23:17:49 +08:00
6 changed files with 68 additions and 20 deletions

No files matched your search

@@ -148,7 +148,7 @@ public class YggdrasilAuthentication {
if (StrUtils.isNotBlank(response.error)) {
HMCLog.err("Failed to log in, the auth server returned an error: " + response.error + ", message: " + response.errorMessage + ", cause: " + response.cause);
if (response.errorMessage.contains("Invalid token"))
if (response.errorMessage != null && response.errorMessage.contains("Invalid token"))
response.errorMessage = C.i18n("login.invalid_token");
throw new AuthenticationException("Request error: " + response.errorMessage);
}
@@ -19,6 +19,7 @@ package org.jackhuang.hellominecraft.launcher.core.launch;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.logging.HMCLog;
@@ -44,13 +45,24 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
@Override
protected void makeSelf(List<String> res) throws GameException {
StringBuilder library = new StringBuilder("");
ArrayList<MinecraftLibrary> opt = new ArrayList<>();
for (MinecraftLibrary l : version.libraries)
if (l.allow() && !l.isRequiredToUnzip()) {
if (l.name.toLowerCase().contains("optifine")) {
opt.add(l);
continue;
}
File f = l.getFilePath(gameDir);
if (f == null)
continue;
library.append(f.getAbsolutePath()).append(File.pathSeparator);
}
for (MinecraftLibrary l : opt) {
File f = l.getFilePath(gameDir);
if (f == null)
continue;
library.append(f.getAbsolutePath()).append(File.pathSeparator);
}
File f = version.getJar(service.baseDirectory());
if (!f.exists())
throw new GameException("Minecraft jar does not exists");
@@ -145,7 +145,7 @@ public class MinecraftVersion implements Cloneable, Comparable<MinecraftVersion>
this.assets != null ? this.assets : parent.assets,
this.jar != null ? this.jar : parent.jar,
null, this.runDir, parent.minimumLauncherVersion,
this.libraries != null ? ArrayUtils.merge(parent.libraries, this.libraries) : parent.libraries, this.hidden,
this.libraries != null ? ArrayUtils.merge(this.libraries, parent.libraries) : parent.libraries, this.hidden,
this.downloads != null ? this.downloads : parent.downloads,
this.assetIndex != null ? this.assetIndex : parent.assetIndex);
@@ -26,6 +26,8 @@
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="btnCheckUpdate" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="btnMCBBS" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="chkDecorated" min="-2" max="-2" attributes="0"/>
</Group>
@@ -125,6 +127,7 @@
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnCheckUpdate" alignment="3" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="chkDecorated" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnMCBBS" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="lblRestart" min="-2" max="-2" attributes="0"/>
@@ -345,5 +348,14 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnMCBBS">
<Properties>
<Property name="text" type="java.lang.String" value="MCBBS"/>
<Property name="toolTipText" type="java.lang.String" value=""/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnMCBBSActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>
@@ -116,6 +116,7 @@ public class LauncherSettingsPanel extends AnimatedPanel {
cboLang = new javax.swing.JComboBox();
lblLang = new javax.swing.JLabel();
lblRestart = new javax.swing.JLabel();
btnMCBBS = new javax.swing.JButton();
cboDownloadSource.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
@@ -240,6 +241,14 @@ public class LauncherSettingsPanel extends AnimatedPanel {
lblRestart.setText(C.i18n("launcher.restart")); // NOI18N
btnMCBBS.setText("MCBBS");
btnMCBBS.setToolTipText("");
btnMCBBS.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnMCBBSActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -253,6 +262,8 @@ public class LauncherSettingsPanel extends AnimatedPanel {
.addComponent(chkEnableAnimation))
.addGroup(layout.createSequentialGroup()
.addComponent(btnCheckUpdate)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnMCBBS)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(chkDecorated))
.addGroup(layout.createSequentialGroup()
@@ -334,7 +345,8 @@ public class LauncherSettingsPanel extends AnimatedPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCheckUpdate, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(chkDecorated))
.addComponent(chkDecorated)
.addComponent(btnMCBBS))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblRestart)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)
@@ -425,8 +437,13 @@ public class LauncherSettingsPanel extends AnimatedPanel {
SwingUtils.openLink("http://huangyuhui.duapp.com/link.php?type=sponsor");
}//GEN-LAST:event_lblAboutMouseClicked
private void btnMCBBSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMCBBSActionPerformed
SwingUtils.openLink(C.URL_PUBLISH);
}//GEN-LAST:event_btnMCBBSActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCheckUpdate;
private javax.swing.JButton btnMCBBS;
private javax.swing.JButton btnSelBackgroundPath;
private javax.swing.JComboBox cboDownloadSource;
private javax.swing.JComboBox cboLang;
+24 -17
View File
@@ -1,24 +1,31 @@
# Hello Minecraft! Launcher [![Build Status](https://travis-ci.org/huanghongxun/HMCL.svg?branch=master)](https://travis-ci.org/huanghongxun/HMCL)
License is GPL v3, see http://www.gnu.org/licenses/gpl.html
开源协议为GPL v3, 详情参见http://www.gnu.org/licenses/gpl.html
## Introduction
## 介绍
This application is a Minecraft launcher that supports mod management, game modification, auto-installing Minecraft/Forge/LiteLoader/OptiFine, modpack manufacture, UI theme customization, and so on.
HMCL是一个Minecraft启动器,支持Mod管理,游戏定制,自动安装,整合包制作,界面主题定制等功能。
并且一天的使用次数在工作日时有40万左右、节假日有150万左右的使用次数,也就是说日活跃用户在10万以上。
但是本项目的代码不够完善,希望有更多的人能加入HMCL的开发。
This application has more than 100,000 users and would be opened more than 500,000 times per day.
## 贡献
如果你很想为本项目贡献代码,这里有一些要求:
* 开发环境为Netbeans 8.1
* 编译器为Java 1.8,通过retrolambda兼容Java 1.7,所以请不要使用Java 8的新API(如Stream)
* 请不要修改`gradle`文件
But the code of this app is not strong, I hope someone could join the development of this app and make this app stronger.
## 代码
* 包 `org.jackhuang.hellominecraft.util` 为HMCL和HMCSM的共用工具代码
* 包 `org.jackhuang.hellominecraft.launcher` 包含了HMCL的界面以及逻辑代码
* 包 `org.jackhuang.hellominecraft.launcher.core` 为HMCL的启动核心
* 包 `org.jackhuang.hellominecraft.launcher.api` 是HMCL为了便于定制提供的API,暂不支持加载插件
* 包 `org.jackhuang.hellominecraft.svrmgr` 为HMCSM的所有代码
* 文件夹 `HMCUtils/src/main/resources/org/jackhuang/hellominecraft/lang` 包含了HMCL和HMCSM使用的语言文件
由于包树已经相当清晰,因此不再赘述各包各类的用途。
## Contribution
If you really want to join the development, here's some requests.
* The Development Environment is Netbeans 8.0.2 with plugin: Gradle Support.
* The project is built on Java 1.8 using the retrolambda backporting to Java 1.7. So DO NOT use the libraries of Java 8 like Stream APIs.
* DO NOT modify any file whose suffix is `gradle`.
## Code tree
* Package `hmc.util` contains all the utilities that HMCL and HMCSM depend on.
* Package `hmc.launcher` contains HMCL ui, a few utility codes.
* Package `hmc.launcher.core` contains all the Minecraft Launcher logic that the HMCL supports.
* Package `hmc.svrmgr` contains all HMCSM logic.
* Folder `HMCLAPI/src/main/resources/org/jackhuang/hellominecraft/lang` contains all the localization files that HMCL and HMCSM used. If you are good at translation, you could join the localization plan by opening a pull request.
## 注意事项
* 包 `org.jackhuang.hellominecraft.util.logging` 包含了经过精简的Apache License 2.0的Log4j项目的代码
* 包 `com.google.gson` 为Google Gson项目Apache License 2.0的代码
* 包 `org.jackhuang.hellominecraft.lookandfeel.ui` 包含了Sun Microsystems的NimbusLookAndFeel项目的部分LGPL代码
* 所有Pull Request提交的代码均会被重写
* 本项目的开源协议是GPL v3,因此包含LGPL和Apache License 2.0的代码是没有法律问题的