rapiddata

This commit is contained in:
huanghongxun 2015-09-29 13:48:12 +08:00
parent 7916715efa
commit 9b95f9d2d7
25 changed files with 175 additions and 114 deletions

View File

@ -25,7 +25,7 @@ if (!hasProperty('mainClass')) {
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main'
}
def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".2" : "."+System.getenv("BUILD_NUMBER")
def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".4" : "."+System.getenv("BUILD_NUMBER")
String mavenGroupId = 'HMCL'
String mavenVersion = '2.3.5' + buildnumber
@ -40,6 +40,10 @@ buildscript {
repositories {
mavenCentral();
maven {
url "https://libraries.minecraft.net"
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:4.10'
classpath 'edu.sc.seis.gradle:launch4j:1.0.6'

View File

@ -30,10 +30,8 @@ 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.system.JdkVersion;
import org.jackhuang.hellominecraft.utils.LauncherPrintStream;
import org.jackhuang.hellominecraft.utils.system.MessageBox;
import org.jackhuang.hellominecraft.utils.system.Platform;
import org.jackhuang.hellominecraft.utils.Utils;
/**
@ -47,11 +45,8 @@ public final class Launcher {
}
public static void main(String[] args) {
Thread.currentThread().setName("launcher");
println("*** " + Main.makeTitle() + " ***");
LogWindow.instance.setTerminateGame(() -> Utils.shutdownForcely(1));
boolean showInfo = false;
String classPath = "";
String mainClass = "net.minecraft.client.Minecraft";
@ -64,18 +59,16 @@ public final class Launcher {
else if (s.equals("-debug")) showInfo = true;
else cmdList.add(s);
String[] cmds = (String[]) cmdList.toArray(new String[cmdList.size()]);
String[] tokenized = StrUtils.tokenize(classPath, File.pathSeparator);
int len = tokenized.length;
if (showInfo) {
LogWindow.instance.setTerminateGame(() -> Utils.shutdownForcely(1));
try {
File logFile = new File("hmclmc.log");
if (!logFile.exists()) logFile.createNewFile();
FileOutputStream tc = new FileOutputStream(logFile);
DoubleOutputStream out = new DoubleOutputStream(tc, System.out);
Launcher l = new Launcher();
System.setOut(new LauncherPrintStream(out));
DoubleOutputStream err = new DoubleOutputStream(tc, System.err);
System.setErr(new LauncherPrintStream(err));
@ -87,12 +80,11 @@ public final class Launcher {
println("Arguments: {\n" + StrUtils.parseParams(" ", args, "\n") + "\n}");
println("Main Class: " + mainClass);
println("Class Path: {\n" + StrUtils.parseParams(" ", tokenized, "\n") + "\n}");
SwingUtilities.invokeLater(() -> LogWindow.instance.setVisible(true));
SwingUtilities.invokeLater(() -> {
LogWindow.instance.setVisible(true);
});
}
if (!JdkVersion.isJava64Bit() && Platform.getPlatform() == Platform.BIT_64)
MessageBox.Show(C.i18n("advice.os64butjdk32"));
URL[] urls = new URL[len];
try {
@ -119,7 +111,7 @@ public final class Launcher {
int flag = 0;
try {
minecraftMain.invoke(null, new Object[]{cmds});
minecraftMain.invoke(null, new Object[]{(String[]) cmdList.toArray(new String[cmdList.size()])});
} catch (Throwable throwable) {
HMCLog.err("Cought exception!");
String trace = StrUtils.getStackTrace(throwable);

View File

@ -102,7 +102,7 @@ public final class Main implements Runnable {
}
public static String launcherName = "Hello Minecraft! Launcher";
public static byte firstVer = 2, secondVer = 3, thirdVer = 5, forthVer = 2;
public static byte firstVer = 2, secondVer = 3, thirdVer = 5, forthVer = 4;
public static int minimumLauncherVersion = 16;
/**
@ -155,6 +155,8 @@ public final class Main implements Runnable {
} catch (Throwable t) {
t.printStackTrace();
}
System.setProperty("sun.java2d.noddraw", "true");
Thread.setDefaultUncaughtExceptionHandler(new CrashReporter(true));

View File

@ -21,6 +21,7 @@ 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;
@ -29,10 +30,12 @@ import org.jackhuang.hellominecraft.utils.system.IOUtils;
import org.jackhuang.hellominecraft.launcher.utils.MCUtils;
import org.jackhuang.hellominecraft.launcher.utils.assets.AssetsIndex;
import org.jackhuang.hellominecraft.launcher.utils.assets.AssetsObject;
import org.jackhuang.hellominecraft.launcher.utils.assets.IAssetsHandler;
import org.jackhuang.hellominecraft.launcher.utils.download.DownloadType;
import org.jackhuang.hellominecraft.utils.system.OS;
import org.jackhuang.hellominecraft.launcher.version.MinecraftLibrary;
import org.jackhuang.hellominecraft.launcher.version.MinecraftVersion;
import org.jackhuang.hellominecraft.tasks.TaskWindow;
import org.jackhuang.hellominecraft.utils.system.FileUtils;
import org.jackhuang.hellominecraft.utils.system.MessageBox;
@ -43,6 +46,7 @@ import org.jackhuang.hellominecraft.utils.system.MessageBox;
public class MinecraftLoader extends AbstractMinecraftLoader {
private MinecraftVersion version;
DownloadType dt;
String text;
public MinecraftLoader(Profile ver, IMinecraftProvider provider, UserProfileProvider lr) throws IllegalStateException {
@ -51,7 +55,7 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
public MinecraftLoader(Profile ver, IMinecraftProvider provider, UserProfileProvider lr, DownloadType downloadtype) throws IllegalStateException {
super(ver, provider, lr);
version = ver.getSelectedMinecraftVersion().resolve(provider, downloadtype);
version = ver.getSelectedMinecraftVersion().resolve(provider, dt = downloadtype);
}
@Override
@ -72,8 +76,13 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
String arg = v.getSelectedMinecraftVersion().minecraftArguments;
String[] splitted = org.jackhuang.hellominecraft.utils.StrUtils.tokenize(arg);
if (!new File(v.getGameDirFile(), "assets").exists())
MessageBox.Show(C.i18n("assets.no_assets"));
if (!checkAssetsExist())
if (MessageBox.Show(C.i18n("assets.no_assets"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
IAssetsHandler.ASSETS_HANDLER.getList(version, provider, (value) -> {
if (value != null)
TaskWindow.getInstance().addTask(IAssetsHandler.ASSETS_HANDLER.getDownloadTask(dt.getProvider())).start();
});
}
String game_assets = reconstructAssets().getAbsolutePath();
@ -114,6 +123,28 @@ public class MinecraftLoader extends AbstractMinecraftLoader {
}
}
private boolean checkAssetsExist() {
File assetsDir = new File(provider.getBaseFolder(), "assets");
File indexDir = new File(assetsDir, "indexes");
File objectDir = new File(assetsDir, "objects");
File indexFile = new File(indexDir, version.getAssets() + ".json");
if (!assetsDir.exists() && !indexFile.isFile())
return false;
try {
AssetsIndex index = (AssetsIndex) C.gson.fromJson(FileUtils.readFileToString(indexFile, "UTF-8"), AssetsIndex.class);
if (index == null) return false;
for (Map.Entry entry : index.getFileMap().entrySet())
if (!new File(new File(objectDir, ((AssetsObject) entry.getValue()).getHash().substring(0, 2)), ((AssetsObject) entry.getValue()).getHash()).exists())
return false;
return true;
} catch (IOException | JsonSyntaxException e) {
return false;
}
}
private File reconstructAssets() {
File assetsDir = new File(provider.getBaseFolder(), "assets");
File indexDir = new File(assetsDir, "indexes");

View File

@ -150,7 +150,7 @@ public final class Config {
configurations = new TreeMap<>();
Profile profile = new Profile();
configurations.put(profile.getName(), profile);
enableShadow = OS.os() == OS.WINDOWS;
enableShadow = false;
theme = 0;
}

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Map;
import org.jackhuang.hellominecraft.C;
import org.jackhuang.hellominecraft.HMCLog;
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftProvider;
import org.jackhuang.hellominecraft.launcher.settings.Settings;
import org.jackhuang.hellominecraft.tasks.Task;
import org.jackhuang.hellominecraft.utils.system.FileUtils;
@ -29,6 +30,7 @@ import org.jackhuang.hellominecraft.utils.system.IOUtils;
import org.jackhuang.hellominecraft.utils.StrUtils;
import org.jackhuang.hellominecraft.launcher.utils.MCUtils;
import org.jackhuang.hellominecraft.launcher.utils.download.IDownloadProvider;
import org.jackhuang.hellominecraft.launcher.version.MinecraftVersion;
import org.jackhuang.hellominecraft.utils.functions.Consumer;
import org.jackhuang.hellominecraft.utils.VersionNumber;
@ -43,7 +45,7 @@ public class AssetsMojangLoader extends IAssetsHandler {
}
@Override
public void getList(final Consumer<String[]> dl) {
public void getList(MinecraftVersion mv, IMinecraftProvider mp, final Consumer<String[]> dl) {
if (mv == null) {
dl.accept(null);
return;

View File

@ -19,7 +19,9 @@ package org.jackhuang.hellominecraft.launcher.utils.assets;
import java.io.File;
import java.util.ArrayList;
import org.jackhuang.hellominecraft.HMCLog;
import org.jackhuang.hellominecraft.launcher.launch.IMinecraftProvider;
import org.jackhuang.hellominecraft.launcher.utils.download.IDownloadProvider;
import org.jackhuang.hellominecraft.launcher.version.MinecraftVersion;
import org.jackhuang.hellominecraft.utils.VersionNumber;
import org.jackhuang.hellominecraft.tasks.Task;
import org.jackhuang.hellominecraft.utils.functions.Consumer;
@ -37,7 +39,7 @@ public class AssetsMojangOldLoader extends IAssetsHandler {
}
@Override
public void getList(final Consumer<String[]> dl) {
public void getList(MinecraftVersion mv, IMinecraftProvider mp, final Consumer<String[]> dl) {
AssetsLoader al = new AssetsLoader(URL);
al.failedEvent.register((sender, e) -> {
HMCLog.warn("Failed to get assets list.", e);

View File

@ -50,18 +50,10 @@ public abstract class IAssetsHandler {
this.name = name;
}
private static final List<IAssetsHandler> assetsHandlers = new ArrayList<>();
public static IAssetsHandler getAssetsHandler(int i) {
return assetsHandlers.get(i);
}
public static List<IAssetsHandler> getAssetsHandlers() {
return assetsHandlers;
}
public static final IAssetsHandler ASSETS_HANDLER;
static {
assetsHandlers.add(new AssetsMojangLoader(C.i18n("assets.list.1_7_3_after")));
ASSETS_HANDLER = new AssetsMojangLoader(C.i18n("assets.list.1_7_3_after"));
}
/**
@ -76,9 +68,11 @@ public abstract class IAssetsHandler {
/**
* All the files assets needed
*
* @param mv The version that needs assets
* @param mp The Minecraft Provider
* @param x finished event
*/
public abstract void getList(Consumer<String[]> x);
public abstract void getList(MinecraftVersion mv, IMinecraftProvider mp, Consumer<String[]> x);
/**
* Will be invoked when the user invoked "Download all assets".
@ -88,21 +82,6 @@ public abstract class IAssetsHandler {
*/
public abstract Task getDownloadTask(IDownloadProvider sourceType);
/**
* assets path
*/
protected MinecraftVersion mv;
protected IMinecraftProvider mp;
/**
* @param mp
* @param mv
*/
public void setAssets(IMinecraftProvider mp, MinecraftVersion mv) {
this.mp = mp;
this.mv = mv;
}
public abstract boolean isVersionAllowed(String formattedVersion);
protected class AssetsTask extends Task {
@ -116,7 +95,7 @@ public abstract class IAssetsHandler {
@Override
public boolean executeTask() {
if (mv == null || assetsDownloadURLs == null) {
if (assetsDownloadURLs == null) {
setFailReason(new RuntimeException(C.i18n("assets.not_refreshed")));
return false;
}

View File

@ -24,7 +24,6 @@ import org.jackhuang.hellominecraft.C;
import org.jackhuang.hellominecraft.HMCLog;
import org.jackhuang.hellominecraft.utils.ArrayUtils;
import org.jackhuang.hellominecraft.views.Selector;
import org.jackhuang.mojang.authlib.Agent;
import org.jackhuang.mojang.authlib.GameProfile;
import org.jackhuang.mojang.authlib.UserType;
import org.jackhuang.mojang.authlib.properties.PropertyMap;
@ -45,7 +44,7 @@ public final class YggdrasilAuthenticator extends IAuthenticator {
public YggdrasilAuthenticator(String clientToken) {
super(clientToken);
service = new YggdrasilAuthenticationService(Proxy.NO_PROXY, clientToken);
ua = (YggdrasilUserAuthentication) service.createUserAuthentication(Agent.MINECRAFT);
ua = (YggdrasilUserAuthentication) service.createUserAuthentication();
}
@Override

View File

@ -26,7 +26,8 @@ public class BMCLAPIDownloadProvider implements IDownloadProvider {
@Override
public InstallerVersionList getForgeInstaller() {
return org.jackhuang.hellominecraft.launcher.utils.installers.forge.bmcl.ForgeBMCLVersionList.getInstance();
//return org.jackhuang.hellominecraft.launcher.utils.installers.forge.bmcl.ForgeBMCLVersionList.getInstance();
return org.jackhuang.hellominecraft.launcher.utils.installers.forge.vanilla.MinecraftForgeVersionList.getInstance();
}
@Override
@ -74,7 +75,7 @@ public class BMCLAPIDownloadProvider implements IDownloadProvider {
@Override
public String getParsedLibraryDownloadURL(String str) {
return str.replace("http://files.minecraftforge.net/maven", "http://bmclapi2.bangbang93.com/maven");
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://bmclapi2.bangbang93.com/maven");
}
@Override

View File

@ -25,7 +25,8 @@ import org.jackhuang.hellominecraft.C;
public enum DownloadType {
Mojang(C.i18n("download.mojang"), new MojangDownloadProvider()),
BMCL(C.i18n("download.BMCL"), new BMCLAPIDownloadProvider());
BMCL(C.i18n("download.BMCL"), new BMCLAPIDownloadProvider()),
RapidData(C.i18n("download.rapid_data"), new RapidDataDownloadProvider());
private final String name;
private final IDownloadProvider provider;

View File

@ -0,0 +1,56 @@
/*
* Copyright 2013 huangyuhui <huanghongxun2008@126.com>
*
* This 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
* (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.
*/
package org.jackhuang.hellominecraft.launcher.utils.download;
/**
*
* @author huangyuhui
*/
public class RapidDataDownloadProvider extends MojangDownloadProvider {
@Override
public String getAssetsDownloadURL() {
return "http://mirrors.rapiddata.org/resources.download.minecraft.net/";
}
@Override
public String getLibraryDownloadURL() {
return "http://mirrors.rapiddata.org/libraries.minecraft.net";
}
@Override
public String getIndexesDownloadURL() {
return "http://mirrors.rapiddata.org/Minecraft.Download/indexes/";
}
@Override
public String getVersionsDownloadURL() {
return "http://mirrors.rapiddata.org/Minecraft.Download/versions/";
}
@Override
public String getVersionsListDownloadURL() {
return "http://mirrors.rapiddata.org/Minecraft.Download/versions/versions.json";
}
@Override
public String getParsedLibraryDownloadURL(String str) {
return str == null ? null : str.replace("http://files.minecraftforge.net/maven", "http://mirrors.rapiddata.org/forge/maven");
}
}

View File

@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jackhuang.hellominecraft.C;
import org.jackhuang.hellominecraft.launcher.settings.Settings;
import org.jackhuang.hellominecraft.utils.StrUtils;
import org.jackhuang.hellominecraft.launcher.utils.installers.InstallerVersionList;
import org.jackhuang.hellominecraft.launcher.utils.installers.InstallerVersionNewerComparator;
@ -47,7 +48,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
@Override
public void refreshList(String[] needed) throws Exception {
String s = NetUtils.doGet(C.URL_FORGE_LIST);
String s = NetUtils.doGet(Settings.getInstance().getDownloadSource().getProvider().getParsedLibraryDownloadURL(C.URL_FORGE_LIST));
if (root != null) return;
root = C.gson.fromJson(s, MinecraftForgeVersionRoot.class);
@ -67,7 +68,7 @@ public class MinecraftForgeVersionList extends InstallerVersionList {
if (!StrUtils.isBlank(v.branch))
ver = ver + "-" + v.branch;
String filename = root.artifact + "-" + ver + "-" + f[1] + "." + f[0];
String url = root.webpath + ver + "/" + filename;
String url = Settings.getInstance().getDownloadSource().getProvider().getParsedLibraryDownloadURL(root.webpath + ver + "/" + filename);
switch (f[1]) {
case "installer":
iv.installer = url;

View File

@ -31,7 +31,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@ -82,7 +81,6 @@ import org.jackhuang.hellominecraft.utils.system.Java;
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersion;
import org.jackhuang.hellominecraft.version.MinecraftRemoteVersions;
import org.jackhuang.hellominecraft.views.LogWindow;
import org.jackhuang.hellominecraft.views.Selector;
/**
*
@ -1310,27 +1308,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
}//GEN-LAST:event_cboLauncherVisibilityFocusLost
private void btnDownloadAllAssetsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDownloadAllAssetsActionPerformed
boolean flag = false;
ArrayList<String> al = new ArrayList<>();
if (minecraftVersion == null) {
MessageBox.Show(C.i18n("mainwindow.no_version"));
return;
}
String s = StrUtils.formatVersion(minecraftVersion.version);
if (StrUtils.isBlank(s)) return;
for (IAssetsHandler a : IAssetsHandler.getAssetsHandlers()) {
if (a.isVersionAllowed(s)) {
downloadAssets(a);
return;
}
al.add(a.getName());
}
if (!flag) {
Selector selector = new Selector(MainFrame.instance, al.toArray(new String[0]), C.i18n("assets.unkown_type_select_one", mcVersion));
selector.setVisible(true);
if (selector.sel != -1)
downloadAssets(IAssetsHandler.getAssetsHandler(selector.sel));
}
downloadAssets(IAssetsHandler.ASSETS_HANDLER);
}//GEN-LAST:event_btnDownloadAllAssetsActionPerformed
private void txtMaxMemoryFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtMaxMemoryFocusLost
@ -1440,7 +1418,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
}//GEN-LAST:event_btnRemoveModActionPerformed
private void lstExternalModsKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_lstExternalModsKeyPressed
if(evt.getKeyCode() == KeyEvent.VK_DELETE)
if (evt.getKeyCode() == KeyEvent.VK_DELETE)
btnRemoveModActionPerformed(null);
}//GEN-LAST:event_lstExternalModsKeyPressed
@ -1481,7 +1459,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
private void btnCleanGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanGameActionPerformed
File f = getProfile().getMinecraftProvider().getRunDirectory(mcVersion);
String[] dir = { "logs", "asm", "NVIDIA", "crash-reports", "server-resource-packs", "natives", "native" };
String[] dir = {"logs", "asm", "NVIDIA", "crash-reports", "server-resource-packs", "natives", "native"};
for (String s : dir) FileUtils.deleteDirectoryQuietly(new File(f, s));
String[] files = {"output-client.log", "usercache.json", "usernamecache.json", "hmclmc.log"};
for (String s : files) new File(f, s).delete();
@ -1596,7 +1574,7 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
private void downloadAssets(final IAssetsHandler type) {
if (mcVersion == null || profile == null) return;
type.getList((value) -> {
type.getList(profile.getMinecraftProvider().getVersionById(mcVersion), profile.getMinecraftProvider(), (value) -> {
if (value != null)
SwingUtilities.invokeLater(() -> TaskWindow.getInstance().addTask(type.getDownloadTask(Settings.getInstance().getDownloadSource().getProvider())).start());
});
@ -1781,16 +1759,6 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
liteloader.loadVersions();
reloadMods();
if (profile == null || version == null) return;
MinecraftVersion v = profile.getMinecraftProvider().getVersionById(version);
if (v != null)
for (IAssetsHandler ph : IAssetsHandler.getAssetsHandlers())
try {
ph.setAssets(profile.getMinecraftProvider(), v);
} catch (Exception e) {
HMCLog.warn("Failed to load assets", e);
}
}
public void onSelected() {
@ -1800,6 +1768,10 @@ btnRefreshLiteLoader.addActionListener(new java.awt.event.ActionListener() {
versionChanged(profile, null);
else versionChanged(getProfile(), (String) cboVersions.getSelectedItem());
}
public void showGameDownloads() {
tabVersionEdit.setSelectedComponent(pnlGameDownloads);
}
// <editor-fold defaultstate="collapsed" desc="UI Definations">
JPopupMenu ppmManage, ppmExplore;

View File

@ -114,10 +114,7 @@
<Component class="javax.swing.JComboBox" name="cboDownloadSource">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="Mojang"/>
<StringItem index="1" value="BMCLAPI(By bangbang93)"/>
</StringArray>
<StringArray count="0"/>
</Property>
</Properties>
<Events>

View File

@ -24,6 +24,7 @@ import javax.swing.filechooser.FileNameExtensionFilter;
import org.jackhuang.hellominecraft.C;
import org.jackhuang.hellominecraft.HMCLog;
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.system.MessageBox;
@ -38,6 +39,11 @@ 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));
txtBackgroundPath.setText(Settings.getInstance().getBgpath());
txtProxyHost.setText(Settings.getInstance().getProxyHost());
@ -81,7 +87,6 @@ public class LauncherSettingsPanel extends javax.swing.JPanel {
txtProxyPassword = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
cboDownloadSource.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Mojang", "BMCLAPI(By bangbang93)" }));
cboDownloadSource.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cboDownloadSourceItemStateChanged(evt);

View File

@ -332,6 +332,7 @@ public class MainPagePanel extends javax.swing.JPanel {
private void txtPlayerNameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtPlayerNameKeyPressed
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
Settings.getInstance().setUsername(txtPlayerName.getText());
int index = cboLoginMode.getSelectedIndex();
if (index < 0) return;
IAuthenticator l = IAuthenticator.logins.get(index);
@ -433,7 +434,10 @@ public class MainPagePanel extends javax.swing.JPanel {
if (getCurrentProfile().getMinecraftProvider().getVersions().isEmpty()) {
if (!showedNoVersion)
SwingUtilities.invokeLater(() -> {
MessageBox.Show(C.i18n("mainwindow.no_version"));
if(MessageBox.Show(C.i18n("mainwindow.no_version"), MessageBox.YES_NO_OPTION) == MessageBox.YES_OPTION) {
MainFrame.instance.selectTab("game");
MainFrame.instance.gamePanel.showGameDownloads();
}
showedNoVersion = true;
});
} else {

View File

@ -20,6 +20,9 @@ if (!hasProperty('mainClass')) {
ext.mainClass = ''
}
if (System.getenv("BUILD_NUMBER") != null)
version = System.getenv("BUILD_NUMBER")
buildscript {
repositories {
mavenCentral();

View File

@ -254,7 +254,7 @@ public class TaskWindow extends javax.swing.JDialog
public void onFailed(Task task) {
SwingUtilities.invokeLater(() -> {
if(taskList == null) return;
failReasons.add(task.getInfo() + ": " + (null == task.getFailReason() ? "No exception" : task.getFailReason().getLocalizedMessage()));
failReasons.add(task.getInfo() + ": " + (null == task.getFailReason() ? "No exception" : (StrUtils.isBlank(task.getFailReason().getLocalizedMessage()) ? task.getFailReason().getClass().getSimpleName() : task.getFailReason().getLocalizedMessage())));
pgsTotal.setMaximum(taskList.taskCount());
pgsTotal.setValue(pgsTotal.getValue() + 1);
int idx = tasks.indexOf(task);

View File

@ -51,15 +51,14 @@ public final class NetUtils {
public static String getStreamContent(InputStream is, String encoding)
throws IOException {
String result;
try (BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding))) {
result = "";
String line;
while ((line = br.readLine()) != null)
result += line + "\n";
StringBuilder sb = new StringBuilder();
try (InputStreamReader br = new InputStreamReader(is, encoding)) {
int len;
char[] buf = new char[16384];
while ((len = br.read(buf)) != -1)
sb.append(buf, 0, len);
}
if (result.length() < 1) return "";
else return result.substring(0, result.length() - 1);
return sb.toString();
}
public static String doGet(String url, String encoding) throws IOException {

View File

@ -166,6 +166,7 @@ ui.label.failed_set=\u8bbe\u7f6e\u5931\u8d25\uff1a
download=\u4e0b\u8f7d
download.mojang=\u5b98\u65b9
download.BMCL=BMCLAPI (bangbang93, http://bmclapi.bangbang93.com/)
download.rapid_data=RapidData (\u9510\u7f51\u4e91\u8ba1\u7b97, https://www.rapiddata.org/)
download.not_200=\u4e0b\u8f7d\u5931\u8d25\uff0c\u56de\u590d\u7801
download.failed=\u4e0b\u8f7d\u5931\u8d25
download.successfully=\u4e0b\u8f7d\u5b8c\u6210
@ -232,7 +233,7 @@ mainwindow.make_launch_script=\u751f\u6210\u542f\u52a8\u811a\u672c
mainwindow.make_launch_script_failed=\u751f\u6210\u542f\u52a8\u811a\u672c\u5931\u8d25
mainwindow.enter_script_name=\u8f93\u5165\u8981\u751f\u6210\u811a\u672c\u7684\u6587\u4ef6\u540d
mainwindow.make_launch_succeed=\u542f\u52a8\u811a\u672c\u5df2\u751f\u6210\u5b8c\u6bd5:
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u60a8\u53ef\u4ee5\u5230[\u8bbe\u7f6e]->[\u6e38\u620f\u4e0b\u8f7d]\u4e2d\u4e0b\u8f7d\u6e38\u620f\u3002
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u8fdb\u5165\u6e38\u620f\u4e0b\u8f7d\uff1f
launcher.about=<html>\u9ed8\u8ba4\u80cc\u666f\u56fe\u6765\u81eaLiberty Dome\u670d\u52a1\u5668\u3002<br/>\u5173\u4e8e\u4f5c\u8005\uff1a<br/>\n\u767e\u5ea6ID\uff1ahuanghongxun20<br/>\nmcbbs\uff1ahuanghongxun<br/>\n\u90ae\u7bb1\uff1ahuanghongxun2008@126.com<br/>\nMinecraft Forum ID: klkl6523<br/>\n\u6b22\u8fce\u63d0\u4ea4Bug\u54e6<br/>\nCopyright (c) 2013-2015 huangyuhui.<br/>\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u6e38\u620f\u7531\u4e8e\u8bef\u64cd\u4f5c\u672c\u542f\u52a8\u5668\u800c\u4e22\u5931\u6570\u636e\u7684\u6982\u4e0d\u8d1f\u8d23\u3002</html>
launcher.download_source=\u4e0b\u8f7d\u6e90
@ -274,7 +275,8 @@ assets.list.1_6=1.6(BMCLAPI)
assets.unkown_type_select_one=\u65e0\u6cd5\u89e3\u6790\u6e38\u620f\u7248\u672c\uff1a%s\uff0c\u8bf7\u9009\u62e9\u4e00\u79cd\u8d44\u6e90\u7c7b\u578b\u4e0b\u8f7d\u3002
assets.type=\u8d44\u6e90\u7c7b\u578b
assets.download=\u4e0b\u8f7d\u8d44\u6e90
assets.no_assets=\u672a\u68c0\u6d4b\u5230assets\u6587\u4ef6\u5939\uff0c\u542f\u52a8\u6e38\u620f\u540e\u5c06\u6ca1\u6709\u58f0\u97f3\u548c\u8bed\u8a00\u6587\u4ef6\uff0c\u8bf7\u5230\u6e38\u620f\u8bbe\u7f6e->\u8d44\u6e90\u4e0b\u8f7d\u4e0b\u8f7d\u8d44\u6e90\u3002
assets.no_assets=\u8d44\u6e90\u6587\u4ef6\u4e0d\u5b8c\u6574\uff0c\u662f\u5426\u8865\u5168\uff1f
assets.failed_download=\u4e0b\u8f7d\u8d44\u6e90\u6587\u4ef6\u5931\u8d25\uff0c\u53ef\u80fd\u5bfc\u81f4\u6ca1\u6709\u4e2d\u6587\u548c\u58f0\u97f3\u3002
gamedownload.not_refreshed=\u6e38\u620f\u4e0b\u8f7d\u5217\u8868\u672a\u5237\u65b0\uff0c\u8bf7\u518d\u5237\u65b0\u4e00\u6b21\u3002

View File

@ -166,6 +166,7 @@ ui.label.failed_set=Failed to set:
download=Download
download.mojang=Mojang
download.BMCL=BMCLAPI (bangbang93, http://bmclapi.bangbang93.com/)
download.rapid_data=RapidData (https://www.rapiddata.org/)
download.not_200=Failed to download, the response code
download.failed=Failed to download
download.successfully=Download Successfully
@ -231,7 +232,7 @@ mainwindow.make_launch_script=Make Launching Script.
mainwindow.make_launch_script_failed=Failed to make script.
mainwindow.enter_script_name=Enter the script name.
mainwindow.make_launch_succeed=Finished script creation.
mainwindow.no_version=No version found. You could download the game in the game settings.
mainwindow.no_version=No version found. Switch to Game Downloads Tab?
launcher.about=<html>About Author<br/>\nEmail\uff1ahuanghongxun2008@126.com<br/>\nMinecraft Forum ID: klkl6523<br/>\nCopyright (c) 2013 huangyuhui</html>
launcher.download_source=Download Source
@ -270,7 +271,8 @@ assets.list.1_7_3_after=1.7.3 And Higher
assets.list.1_6=1.6(BMCLAPI)
assets.type=Asset Type
assets.download=Download Assets
assets.no_assets=No assets folder found, there's no sound & language file gaming. You can go to Game Settings->Assets Download to download assets.
assets.no_assets=Assets are not complete, complete them?
assets.failed_download=Failed to download assets, may cause no sounds and language files.
gamedownload.not_refreshed=The game list is not refreshed, please refresh it once.

View File

@ -166,6 +166,7 @@ ui.label.failed_set=\u8bbe\u7f6e\u5931\u8d25\uff1a
download=\u4e0b\u8f7d
download.mojang=\u5b98\u65b9
download.BMCL=BMCLAPI (bangbang93, http://bmclapi.bangbang93.com/)
download.rapid_data=RapidData (\u9510\u7f51\u4e91\u8ba1\u7b97, https://www.rapiddata.org/)
download.not_200=\u4e0b\u8f7d\u5931\u8d25\uff0c\u56de\u590d\u7801
download.failed=\u4e0b\u8f7d\u5931\u8d25
download.successfully=\u4e0b\u8f7d\u5b8c\u6210
@ -232,7 +233,7 @@ mainwindow.make_launch_script=\u751f\u6210\u542f\u52a8\u811a\u672c
mainwindow.make_launch_script_failed=\u751f\u6210\u542f\u52a8\u811a\u672c\u5931\u8d25
mainwindow.enter_script_name=\u8f93\u5165\u8981\u751f\u6210\u811a\u672c\u7684\u6587\u4ef6\u540d
mainwindow.make_launch_succeed=\u542f\u52a8\u811a\u672c\u5df2\u751f\u6210\u5b8c\u6bd5:
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u60a8\u53ef\u4ee5\u5230[\u8bbe\u7f6e]->[\u6e38\u620f\u4e0b\u8f7d]\u4e2d\u4e0b\u8f7d\u6e38\u620f\u3002
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u8fdb\u5165\u6e38\u620f\u4e0b\u8f7d\uff1f
launcher.about=<html>\u9ed8\u8ba4\u80cc\u666f\u56fe\u6765\u81eaLiberty Dome\u670d\u52a1\u5668\u3002<br/>\u5173\u4e8e\u4f5c\u8005\uff1a<br/>\n\u767e\u5ea6ID\uff1ahuanghongxun20<br/>\nmcbbs\uff1ahuanghongxun<br/>\n\u90ae\u7bb1\uff1ahuanghongxun2008@126.com<br/>\nMinecraft Forum ID: klkl6523<br/>\n\u6b22\u8fce\u63d0\u4ea4Bug\u54e6<br/>\nCopyright (c) 2013-2015 huangyuhui.<br/>\u514d\u8d23\u58f0\u660e\uff1aMinecraft\u8f6f\u4ef6\u7248\u6743\u5f52Mojang AB\u6240\u6709\uff0c\u6e38\u620f\u7531\u4e8e\u8bef\u64cd\u4f5c\u672c\u542f\u52a8\u5668\u800c\u4e22\u5931\u6570\u636e\u7684\u6982\u4e0d\u8d1f\u8d23\u3002</html>
launcher.download_source=\u4e0b\u8f7d\u6e90
@ -274,7 +275,8 @@ assets.list.1_6=1.6(BMCLAPI)
assets.unkown_type_select_one=\u65e0\u6cd5\u89e3\u6790\u6e38\u620f\u7248\u672c\uff1a%s\uff0c\u8bf7\u9009\u62e9\u4e00\u79cd\u8d44\u6e90\u7c7b\u578b\u4e0b\u8f7d\u3002
assets.type=\u8d44\u6e90\u7c7b\u578b
assets.download=\u4e0b\u8f7d\u8d44\u6e90
assets.no_assets=\u672a\u68c0\u6d4b\u5230assets\u6587\u4ef6\u5939\uff0c\u542f\u52a8\u6e38\u620f\u540e\u5c06\u6ca1\u6709\u58f0\u97f3\u548c\u8bed\u8a00\u6587\u4ef6\uff0c\u8bf7\u5230\u6e38\u620f\u8bbe\u7f6e->\u8d44\u6e90\u4e0b\u8f7d\u4e0b\u8f7d\u8d44\u6e90\u3002
assets.no_assets=\u8d44\u6e90\u6587\u4ef6\u4e0d\u5b8c\u6574\uff0c\u662f\u5426\u8865\u5168\uff1f
assets.failed_download=\u4e0b\u8f7d\u8d44\u6e90\u6587\u4ef6\u5931\u8d25\uff0c\u53ef\u80fd\u5bfc\u81f4\u6ca1\u6709\u4e2d\u6587\u548c\u58f0\u97f3\u3002
gamedownload.not_refreshed=\u6e38\u620f\u4e0b\u8f7d\u5217\u8868\u672a\u5237\u65b0\uff0c\u8bf7\u518d\u5237\u65b0\u4e00\u6b21\u3002

View File

@ -166,6 +166,7 @@ ui.label.failed_set=\u8a2d\u5b9a\u5931\u6557\uff1a
download=\u4e0b\u8f09
download.mojang=\u5b98\u65b9
download.BMCL=BMCLAPI (bangbang93, http://bmclapi.bangbang93.com/)
download.rapid_data=RapidData (\u92b3\u7db2\u96f2\u8a08\u7b97, https://www.rapiddata.org/)
download.not_200=\u4e0b\u8f09\u5931\u6557\uff0c\u56de\u590d\u7801
download.failed=\u4e0b\u8f09\u5931\u6557
download.successfully=\u4e0b\u8f09\u5b8c\u6210
@ -232,7 +233,7 @@ mainwindow.make_launch_script=\u751f\u6210\u555f\u52d5\u8173\u672c
mainwindow.make_launch_script_failed=\u751f\u6210\u555f\u52d5\u8173\u672c\u5931\u6557
mainwindow.enter_script_name=\u8f38\u5165\u8981\u751f\u6210\u8173\u672c\u7684\u6587\u4ef6\u540d
mainwindow.make_launch_succeed=\u555f\u52d5\u8173\u672c\u5df2\u751f\u6210\u5b8c\u7562:
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u60a8\u53ef\u4ee5\u5230[\u8a2d\u5b9a]->[\u904a\u6232\u4e0b\u8f09]\u4e2d\u4e0b\u8f09\u904a\u6232\u3002
mainwindow.no_version=\u672a\u627e\u5230\u4efb\u4f55\u7248\u672c\uff0c\u662f\u5426\u9032\u5165\u904a\u6232\u4e0b\u8f09\uff1f
launcher.about=<html>\u9ed8\u8a8d\u80cc\u666f\u5716\u4f86\u81eaLiberty Dome\u670d\u52d9\u5668\u3002<br/>\u95dc\u65bc\u4f5c\u8005\uff1a<br/>\n\u767e\u5ea6ID\uff1ahuanghongxun20<br/>\nmcbbs\uff1ahuanghongxun<br/>\n\u90f5\u7bb1\uff1ahuanghongxun2008@126.com<br/>\nMinecraft Forum ID: klkl6523<br/>\n\u6b61\u8fce\u63d0\u4ea4Bug\u54e6<br/>\nCopyright (c) 2013 huangyuhui</html>
launcher.download_source=\u4e0b\u8f09\u6e90
@ -273,7 +274,8 @@ assets.list.1_7_3_after=1.7.3\u53ca\u4ee5\u5f8c
assets.list.1_6=1.6(BMCLAPI)
assets.type=\u8cc7\u6e90\u985e\u578b
assets.download=\u4e0b\u8f09\u8cc7\u6e90
assets.no_assets=\u672a\u68c0\u6d4b\u5230assets\u6587\u4ef6\u5939\uff0c\u542f\u52a8\u6e38\u620f\u540e\u5c06\u6ca1\u6709\u58f0\u97f3\u548c\u8bed\u8a00\u6587\u4ef6\uff0c\u8bf7\u5230\u6e38\u620f\u8bbe\u7f6e->\u8d44\u6e90\u4e0b\u8f7d\u4e0b\u8f7d\u8d44\u6e90\u3002
assets.no_assets=\u8cc7\u6e90\u6587\u4ef6\u4e0d\u5b8c\u6574\uff0c\u662f\u5426\u88dc\u5168\uff1f
assets.failed_download=\u4e0b\u8f09\u8cc7\u6e90\u6587\u4ef6\u5931\u6557\uff0c\u53ef\u80fd\u5c0e\u81f4\u6c92\u6709\u4e2d\u6587\u548c\u8072\u97f3\u3002
gamedownload.not_refreshed=\u904a\u6232\u4e0b\u8f09\u5217\u8868\u672a\u5237\u65b0\uff0c\u8acb\u518d\u5237\u65b0\u4e00\u6b21\u3002

View File

@ -20,6 +20,9 @@ if (!hasProperty('mainClass')) {
ext.mainClass = ''
}
if (System.getenv("BUILD_NUMBER") != null)
version = System.getenv("BUILD_NUMBER")
buildscript {
repositories {
mavenCentral();