Add some javadoc

This commit is contained in:
huangyuhui
2017-02-13 18:59:04 +08:00
parent 5a6e1ffcd9
commit c1208563cd
29 changed files with 102 additions and 72 deletions

View File

@@ -20,9 +20,18 @@ package org.jackhuang.hellominecraft.launcher.api;
import org.jackhuang.hellominecraft.util.ui.Page; import org.jackhuang.hellominecraft.util.ui.Page;
/** /**
* Used for adding tab page to MainFrame.
* *
* @author huang * @author huang
*/ */
public interface AddTabCallback { public interface AddTabCallback {
/**
* Add your tab page to MainFrame.
*
* @param tabPage your customized tab page.
* @param id the id of your page.
* @param title you are supposed to localize your texts.
*/
void addTab(Page tabPage, String id, String title); void addTab(Page tabPage, String id, String title);
} }

View File

@@ -22,6 +22,7 @@ import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
import org.jackhuang.hellominecraft.util.func.Consumer; import org.jackhuang.hellominecraft.util.func.Consumer;
/** /**
* Each plugin must implement this interface.
* *
* @author huangyuhui * @author huangyuhui
*/ */
@@ -34,5 +35,11 @@ public interface IPlugin {
*/ */
void onRegisterAuthenticators(Consumer<IAuthenticator> apply); void onRegisterAuthenticators(Consumer<IAuthenticator> apply);
/**
* Call callback.addTab to add your customized panel to MainFrame RootPane.
*
* @param frame MainFrame
* @param callback call this if you want.
*/
void onAddTab(JFrame frame, AddTabCallback callback); void onAddTab(JFrame frame, AddTabCallback callback);
} }

View File

@@ -21,9 +21,9 @@ import java.util.ArrayList;
import javax.swing.JFrame; import javax.swing.JFrame;
import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator; import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
import org.jackhuang.hellominecraft.util.func.Consumer; import org.jackhuang.hellominecraft.util.func.Consumer;
import org.jackhuang.hellominecraft.util.log.HMCLog;
/** /**
* Can be only called by HMCL.
* *
* @author huangyuhui * @author huangyuhui
*/ */
@@ -35,8 +35,9 @@ public class PluginManager {
try { try {
IPlugin p = (IPlugin) cls.newInstance(); IPlugin p = (IPlugin) cls.newInstance();
PLUGINS.add(p); PLUGINS.add(p);
} catch (IllegalAccessException | InstantiationException e) { } catch (Throwable e) {
HMCLog.err("Failed to new instance"); System.err.println("Failed to new instance");
e.printStackTrace();
} }
} }

View File

@@ -22,7 +22,9 @@ import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
/** /**
* This event gets fired when the authenticator changed. * This event gets fired when the authenticator changed.
* * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.setting.Config}
* @param IAuthenticator the new authenticator. * @param IAuthenticator the new authenticator.
* @author huangyuhui * @author huangyuhui
*/ */

View File

@@ -22,8 +22,10 @@ import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
/** /**
* This event gets fired when the download type changed. * This event gets fired when the download type changed.
* * <br>
* @param DownloadType the new downlaod type; * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.setting.Config}
* @param DownloadType the new downlaod type
* @author huangyuhui * @author huangyuhui
*/ */
public class DownloadTypeChangedEvent extends SimpleEvent<DownloadType> { public class DownloadTypeChangedEvent extends SimpleEvent<DownloadType> {

View File

@@ -22,7 +22,9 @@ import org.jackhuang.hellominecraft.lookandfeel.Theme;
/** /**
* This event gets fired when the application theme changed. * This event gets fired when the application theme changed.
* * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.setting.Config}
* @param Theme the changed theme * @param Theme the changed theme
* @author huangyuhui * @author huangyuhui
*/ */

View File

@@ -25,7 +25,7 @@ import org.jackhuang.hellominecraft.api.ResultedSimpleEvent;
* This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent} * This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent}
* If this event is failed, the launching process will be terminated. * If this event is failed, the launching process will be terminated.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* @param DecompressLibraryJob libraries to be decompressed * @param DecompressLibraryJob libraries to be decompressed
* @author huangyuhui * @author huangyuhui

View File

@@ -31,6 +31,7 @@ public class DecompressLibraryJob {
/** /**
* The length of these 2 arrays must be the same. * The length of these 2 arrays must be the same.
*
* @param decompressFiles * @param decompressFiles
* @param extractRules * @param extractRules
* @param decompressTo folder * @param decompressTo folder

View File

@@ -26,7 +26,7 @@ import org.jackhuang.hellominecraft.api.ResultedSimpleEvent;
* This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent} * This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent}
* If this event is failed, the launching process will be terminated. * If this event is failed, the launching process will be terminated.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* Passed value List&lt;DownloadLibraryJob&gt;: libraries to be downloaded. * Passed value List&lt;DownloadLibraryJob&gt;: libraries to be downloaded.
* @author huangyuhui * @author huangyuhui

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/** /**
* This event gets fired when we launched the game. * This event gets fired when we launched the game.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* @param JavaProcess the game process * @param JavaProcess the game process
* @author huangyuhui * @author huangyuhui

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.api.SimpleEvent;
/** /**
* This event gets fired when we make the launching command successfully(not launched the game process). * This event gets fired when we make the launching command successfully(not launched the game process).
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* @param List&lt;String&gt; Our launching command. * @param List&lt;String&gt; Our launching command.
* @author huangyuhui * @author huangyuhui

View File

@@ -22,7 +22,7 @@ import org.jackhuang.hellominecraft.api.SimpleEvent;
/** /**
* This event gets fired when we are launching a game and mark what things we are doing. * This event gets fired when we are launching a game and mark what things we are doing.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* @param LaunchingState the launching state. * @param LaunchingState the launching state.
* @author huangyuhui * @author huangyuhui

View File

@@ -26,7 +26,7 @@ import org.jackhuang.hellominecraft.launcher.core.launch.LaunchOptions;
* Pay attension: If you need to terminate the launching process, you must throw * Pay attension: If you need to terminate the launching process, you must throw
* {@link org.jackhuang.hellominecraft.launcher.core.RuntimeGameException anyway. * {@link org.jackhuang.hellominecraft.launcher.core.RuntimeGameException anyway.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* @param LaunchOptions you can modify the value of this event to control the launching process. * @param LaunchOptions you can modify the value of this event to control the launching process.
* @author huang * @author huang

View File

@@ -26,7 +26,7 @@ import org.jackhuang.hellominecraft.launcher.core.auth.UserProfileProvider;
* Pay attension: If you need to terminate the launching process, you must throw * Pay attension: If you need to terminate the launching process, you must throw
* {@link org.jackhuang.hellominecraft.launcher.core.RuntimeGameException anyway. * {@link org.jackhuang.hellominecraft.launcher.core.RuntimeGameException anyway.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher} * @param source {@link org.jackhuang.hellominecraft.launcher.core.launch.GameLauncher}
* @param UserProfileProvider you can modify the value of this event to control the user profile. * @param UserProfileProvider you can modify the value of this event to control the user profile.
* @author huangyuhui * @author huangyuhui

View File

@@ -22,7 +22,7 @@ import org.jackhuang.hellominecraft.api.SimpleEvent;
/** /**
* This event gets fired when a minecraft version has been loaded. * This event gets fired when a minecraft version has been loaded.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager} * @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager}
* @param String the version id. * @param String the version id.
* @author huang * @author huang

View File

@@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.util.Wrapper;
/** /**
* This event gets fired when we getting minecraft library path. * This event gets fired when we getting minecraft library path.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftLibrary} * @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftLibrary}
* @param {@code Wrapper<File>} modify this thing to change to your wanted mc lib. * @param {@code Wrapper<File>} modify this thing to change to your wanted mc lib.
* @author huangyuhui * @author huangyuhui

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
/** /**
* This event gets fired when all the versions in .minecraft folder are loaded. * This event gets fired when all the versions in .minecraft folder are loaded.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager} * @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager}
* @param IMinecraftService the .minecraft folder. * @param IMinecraftService the .minecraft folder.
* @author huangyuhui * @author huangyuhui

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
/** /**
* This event gets fired when loading versions in a .minecraft folder. * This event gets fired when loading versions in a .minecraft folder.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager} * @param source {@link org.jackhuang.hellominecraft.launcher.core.version.MinecraftVersionManager}
* @param IMinecraftService .minecraft folder. * @param IMinecraftService .minecraft folder.
* @author huang * @author huang

View File

@@ -112,7 +112,7 @@ public final class Main implements Runnable {
try { try {
PluginManager.getPlugin(Class.forName(c)); PluginManager.getPlugin(Class.forName(c));
} catch (ClassNotFoundException ex) { } catch (ClassNotFoundException ex) {
System.out.println("Class: " + c + " not found, please add your plugin jar to class path."); LOGGER.log(Level.WARNING, "Class: " + c + " not found, please add your plugin jar to class path.", ex);
} }
} else if (s.startsWith("--help")) { } else if (s.startsWith("--help")) {
System.out.println("HMCL command line help"); System.out.println("HMCL command line help");

View File

@@ -22,6 +22,9 @@ import org.jackhuang.hellominecraft.launcher.setting.Profile;
/** /**
* This event gets fired when the selected profile changed. * This event gets fired when the selected profile changed.
* <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.setting.Settings}
* @param Profile the new profile. * @param Profile the new profile.
* @author huangyuhui * @author huangyuhui
*/ */

View File

@@ -21,7 +21,10 @@ import java.util.EventObject;
/** /**
* This event gets fired when loading profiles. * This event gets fired when loading profiles.
* @author huang * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.launcher.setting.Settings}
* @author huangyuhui
*/ */
public class ProfileLoadingEvent extends EventObject { public class ProfileLoadingEvent extends EventObject {

View File

@@ -20,17 +20,17 @@ buildscript {
repositories { repositories {
mavenCentral(); mavenCentral();
dependencies { dependencies {
classpath 'edu.sc.seis.gradle:launch4j:1.0.6' classpath 'me.tatarka:gradle-retrolambda:3.1.0'
classpath 'me.tatarka:gradle-retrolambda:3.4.0'
} }
} }
} }
plugins { plugins {
id "edu.sc.seis.macAppBundle" version "2.1.6" id "edu.sc.seis.macAppBundle" version "2.1.6"
//id "me.tatarka.retrolambda" version "3.5.0"
id 'edu.sc.seis.launch4j' version '2.3.0'
} }
apply plugin: 'launch4j'
apply plugin: 'me.tatarka.retrolambda' apply plugin: 'me.tatarka.retrolambda'
if (!hasProperty('mainClass')) { if (!hasProperty('mainClass')) {

View File

@@ -26,7 +26,7 @@ import org.jackhuang.hellominecraft.util.VersionNumber;
* This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent} * This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent}
* If this event is failed, HMCL will not ask user to upgrade the application. * If this event is failed, HMCL will not ask user to upgrade the application.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.util.UpdateChecker} * @param source {@link org.jackhuang.hellominecraft.util.UpdateChecker}
* @param VersionNumber newest version * @param VersionNumber newest version
* @author huang * @author huang

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/** /**
* This event gets fired when we launch the JVM and it got crashed. * This event gets fired when we launch the JVM and it got crashed.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor} * @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor}
* @param JavaProcess the crashed process. * @param JavaProcess the crashed process.
* @author huangyuhui * @author huangyuhui

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/** /**
* This event gets fired when a JavaProcess exited abnormally and the exit code is not zero. * This event gets fired when a JavaProcess exited abnormally and the exit code is not zero.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor} * @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor}
* @param JavaProcess The process that exited abnormally. * @param JavaProcess The process that exited abnormally.
* @author huangyuhui * @author huangyuhui

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/** /**
* This event gets fired when a JavaProcess is starting. * This event gets fired when a JavaProcess is starting.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor} * @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor}
* @param JavaProcess the starting JavaProcess. * @param JavaProcess the starting JavaProcess.
* @author huang * @author huang

View File

@@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/** /**
* This event gets fired when minecraft process exited successfully and the exit code is 0. * This event gets fired when minecraft process exited successfully and the exit code is 0.
* <br> * <br>
* This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCLAPI#EVENT_BUS} * This event is fired on the {@link org.jackhuang.hellominecraft.api.HMCAPI#EVENT_BUS}
* @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor} * @param source {@link org.jackhuang.hellominecraft.util.sys.JavaProcessMonitor}
* @param JavaProcess minecraft process * @param JavaProcess minecraft process
* @author huangyuhui * @author huangyuhui