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;
/**
* Used for adding tab page to MainFrame.
*
* @author huang
*/
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);
}

View File

@ -22,6 +22,7 @@ import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
import org.jackhuang.hellominecraft.util.func.Consumer;
/**
* Each plugin must implement this interface.
*
* @author huangyuhui
*/
@ -33,6 +34,12 @@ public interface IPlugin {
* @param apply call apply.accept(your authenticator)
*/
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);
}

View File

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

View File

@ -22,7 +22,9 @@ import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
/**
* 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.
* @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.
*
* @param DownloadType the new downlaod type;
* <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 DownloadType the new downlaod type
* @author huangyuhui
*/
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.
*
* <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
* @author huangyuhui
*/

View File

@ -25,7 +25,7 @@ import org.jackhuang.hellominecraft.api.ResultedSimpleEvent;
* This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent}
* If this event is failed, the launching process will be terminated.
* <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 DecompressLibraryJob libraries to be decompressed
* @author huangyuhui

View File

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

View File

@ -26,7 +26,7 @@ import org.jackhuang.hellominecraft.api.ResultedSimpleEvent;
* This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent}
* If this event is failed, the launching process will be terminated.
* <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}
* Passed value List&lt;DownloadLibraryJob&gt;: libraries to be downloaded.
* @author huangyuhui

View File

@ -35,7 +35,7 @@ public class DownloadLibraryJob {
lib = n;
path = p;
}
public DownloadLibraryJob parse() {
String name = lib.name;
if (name.startsWith("net.minecraftforge:forge:")) {

View File

@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/**
* This event gets fired when we launched the game.
* <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 JavaProcess the game process
* @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).
* <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 List&lt;String&gt; Our launching command.
* @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.
* <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 LaunchingState the launching state.
* @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
* {@link org.jackhuang.hellominecraft.launcher.core.RuntimeGameException anyway.
* <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 LaunchOptions you can modify the value of this event to control the launching process.
* @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
* {@link org.jackhuang.hellominecraft.launcher.core.RuntimeGameException anyway.
* <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 UserProfileProvider you can modify the value of this event to control the user profile.
* @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.
* <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 String the version id.
* @author huang

View File

@ -24,7 +24,7 @@ import org.jackhuang.hellominecraft.util.Wrapper;
/**
* This event gets fired when we getting minecraft library path.
* <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 {@code Wrapper<File>} modify this thing to change to your wanted mc lib.
* @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.
* <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 IMinecraftService the .minecraft folder.
* @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.
* <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 IMinecraftService .minecraft folder.
* @author huang

View File

@ -112,7 +112,7 @@ public final class Main implements Runnable {
try {
PluginManager.getPlugin(Class.forName(c));
} 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")) {
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.
* <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.
* @author huangyuhui
*/

View File

@ -21,7 +21,10 @@ import java.util.EventObject;
/**
* 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 {

View File

@ -28,50 +28,50 @@ import org.jackhuang.hellominecraft.util.C;
*/
public enum Theme {
BLUE(C.i18n("color.blue"), new HashMap<String, String>() {
{
put("Customized.TabbedPaneTab.selected_foreground", "#106CA3");
put("Customized.ComboBox.selected_background", "#A0D8F0");
put("Customized.MainFrame.background", "#106CA3");
put("Customized.MainFrame.selected_background", "#0C5E91");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
{
put("Customized.TabbedPaneTab.selected_foreground", "#106CA3");
put("Customized.ComboBox.selected_background", "#A0D8F0");
put("Customized.MainFrame.background", "#106CA3");
put("Customized.MainFrame.selected_background", "#0C5E91");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
GREEN(C.i18n("color.green"), new HashMap<String, String>() {
{
put("Customized.TabbedPaneTab.selected_foreground", "#1ABC9C");
put("Customized.ComboBox.selected_background", "#1ABC9C");
put("Customized.MainFrame.background", "#1ABC9C");
put("Customized.MainFrame.selected_background", "#16A085");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
{
put("Customized.TabbedPaneTab.selected_foreground", "#1ABC9C");
put("Customized.ComboBox.selected_background", "#1ABC9C");
put("Customized.MainFrame.background", "#1ABC9C");
put("Customized.MainFrame.selected_background", "#16A085");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
PURPLE(C.i18n("color.purple"), new HashMap<String, String>() {
{
put("Customized.TabbedPaneTab.selected_foreground", "#9B59B6");
put("Customized.ComboBox.selected_background", "#9B59B6");
put("Customized.MainFrame.background", "#9B59B6");
put("Customized.MainFrame.selected_background", "#8E44AD");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
{
put("Customized.TabbedPaneTab.selected_foreground", "#9B59B6");
put("Customized.ComboBox.selected_background", "#9B59B6");
put("Customized.MainFrame.background", "#9B59B6");
put("Customized.MainFrame.selected_background", "#8E44AD");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
DARKER_BLUE(C.i18n("color.dark_blue"), new HashMap<String, String>() {
{
put("Customized.TabbedPaneTab.selected_foreground", "#34495E");
put("Customized.ComboBox.selected_background", "#34495E");
put("Customized.MainFrame.background", "#34495E");
put("Customized.MainFrame.selected_background", "#2C3E50");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
{
put("Customized.TabbedPaneTab.selected_foreground", "#34495E");
put("Customized.ComboBox.selected_background", "#34495E");
put("Customized.MainFrame.background", "#34495E");
put("Customized.MainFrame.selected_background", "#2C3E50");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
ORANGE(C.i18n("color.orange"), new HashMap<String, String>() {
{
put("Customized.TabbedPaneTab.selected_foreground", "#E67E22");
put("Customized.ComboBox.selected_background", "#F39C12");
put("Customized.MainFrame.background", "#E67E22");
put("Customized.MainFrame.selected_background", "#D35400");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
{
put("Customized.TabbedPaneTab.selected_foreground", "#E67E22");
put("Customized.ComboBox.selected_background", "#F39C12");
put("Customized.MainFrame.background", "#E67E22");
put("Customized.MainFrame.selected_background", "#D35400");
put("Customized.MainFrame.background_image", "background.jpg");
}
}),
RED(C.i18n("color.red"), new HashMap<String, String>() {
{
put("Customized.TabbedPaneTab.selected_foreground", "#E74C3C");

View File

@ -20,17 +20,17 @@ buildscript {
repositories {
mavenCentral();
dependencies {
classpath 'edu.sc.seis.gradle:launch4j:1.0.6'
classpath 'me.tatarka:gradle-retrolambda:3.4.0'
classpath 'me.tatarka:gradle-retrolambda:3.1.0'
}
}
}
plugins {
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'
if (!hasProperty('mainClass')) {

View File

@ -26,7 +26,7 @@ import org.jackhuang.hellominecraft.util.VersionNumber;
* This event is {@link org.jackhuang.hellominecraft.api.ResultedEvent}
* If this event is failed, HMCL will not ask user to upgrade the application.
* <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 VersionNumber newest version
* @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.
* <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 JavaProcess the crashed process.
* @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.
* <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 JavaProcess The process that exited abnormally.
* @author huangyuhui

View File

@ -23,7 +23,7 @@ import org.jackhuang.hellominecraft.util.sys.JavaProcess;
/**
* This event gets fired when a JavaProcess is starting.
* <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 JavaProcess the starting JavaProcess.
* @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.
* <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 JavaProcess minecraft process
* @author huangyuhui