Reconstruct codes

This commit is contained in:
huangyuhui 2016-05-13 18:25:55 +08:00
parent 2862e3a6ee
commit ce721c2e09
297 changed files with 56 additions and 22 deletions

2
.gitignore vendored Executable file → Normal file
View File

@ -25,3 +25,5 @@ HMCL/build/
HMCLServer/
HMCSM/build/
MetroLookAndFeel/build/
/HMCUtils/build/
/HMCLaF/build/

View File

@ -55,6 +55,35 @@ task generateSources(type: Copy) {
compileJava.setSource "$buildDir/generated-src"
compileJava.dependsOn generateSources
sourceSets {
main {
java {
srcDirs = [
'src/core/java/',
'src/main/java/'
]
}
resources {
srcDirs = ['src/main/resources/']
}
}
core {
java {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
srcDirs 'src/core/java/'
}
resources {
srcDirs 'src/main/resources/'
}
}
}
configurations {
coreCompile.extendsFrom compile
coreRuntime.extendsFrom runtime
}
buildscript {
repositories {
mavenCentral();
@ -80,8 +109,8 @@ configure(install.repositories.mavenInstaller) {
}
dependencies {
compile project(":MetroLookAndFeel")
compile project(":HMCLAPI")
compile project(":HMCLaF")
compile project(":HMCUtils")
compile group: "org.commonjava.googlecode.markdown4j", name: "markdown4j", version: "2.2-cj-1.0"
}

View File

@ -19,7 +19,6 @@ package org.jackhuang.hellominecraft.launcher.api;
import org.jackhuang.hellominecraft.launcher.core.GameException;
import org.jackhuang.hellominecraft.launcher.core.service.IMinecraftService;
import org.jackhuang.hellominecraft.launcher.setting.Profile;
import org.jackhuang.hellominecraft.launcher.core.auth.AuthenticationException;
import org.jackhuang.hellominecraft.launcher.core.auth.IAuthenticator;
import org.jackhuang.hellominecraft.launcher.core.auth.UserProfileProvider;
@ -35,12 +34,12 @@ public interface IPlugin {
/**
* You can modify the application actions by this method.
*
* @param profile info to the Minecraft Loader
* @param obj minecraft service wanted
*
* @return For example, you can implement IMinecraftProvider to support
* MultiMC
*/
IMinecraftService provideMinecraftService(Profile profile);
IMinecraftService provideMinecraftService(Object obj);
/**
* Register authenticators by calling IAuthenticator.LOGINS.add.

View File

@ -18,7 +18,6 @@
package org.jackhuang.hellominecraft.launcher.api;
import org.jackhuang.hellominecraft.util.logging.HMCLog;
import org.jackhuang.hellominecraft.launcher.util.DefaultPlugin;
/**
*
@ -26,17 +25,21 @@ import org.jackhuang.hellominecraft.launcher.util.DefaultPlugin;
*/
public class PluginManager {
private static IPlugin NOW_PLUGIN = new DefaultPlugin();
private static IPlugin NOW_PLUGIN;
public static void getServerPlugin() {
try {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Class c = cl.loadClass("org.jackhuang.hellominecraft.launcher.server.ServerPlugin");
IPlugin p = (IPlugin) c.newInstance();
NOW_PLUGIN = p;
getPlugin(Thread.currentThread().getContextClassLoader().loadClass("org.jackhuang.hellominecraft.launcher.server.ServerPlugin"));
} catch (ClassNotFoundException ignore) {
}
}
public static void getPlugin(Class<?> cls) {
try {
IPlugin p = (IPlugin) cls.newInstance();
NOW_PLUGIN = p;
} catch (Exception e) {
HMCLog.err("Failed to new instance");
HMCLog.err("Failed to new instance");
}
}

View File

@ -46,6 +46,7 @@ import org.jackhuang.hellominecraft.util.ui.LogWindow;
import org.jackhuang.hellominecraft.launcher.setting.Settings;
import org.jackhuang.hellominecraft.launcher.util.upgrade.IUpgrader;
import org.jackhuang.hellominecraft.launcher.ui.MainFrame;
import org.jackhuang.hellominecraft.launcher.util.DefaultPlugin;
import org.jackhuang.hellominecraft.lookandfeel.HelloMinecraftLookAndFeel;
import org.jackhuang.hellominecraft.util.MathUtils;
import org.jackhuang.hellominecraft.util.StrUtils;
@ -118,7 +119,7 @@ public final class Main implements Runnable {
@SuppressWarnings({ "CallToPrintStackTrace", "UseSpecificCatch" })
public static void main(String[] args) throws IOException {
{
//PluginManager.getServerPlugin();
PluginManager.getPlugin(DefaultPlugin.class);
if (IUpgrader.NOW_UPGRADER.parseArguments(getVersionNumber(), args))
return;

View File

@ -42,8 +42,8 @@ public class DefaultPlugin implements IPlugin {
SkinmeAuthenticator SKINME_LOGIN = null;
@Override
public IMinecraftService provideMinecraftService(Profile profile) {
return new HMCLMinecraftService(profile);
public IMinecraftService provideMinecraftService(Object profile) {
return new HMCLMinecraftService((Profile) profile);
}
@Override

View File

@ -35,7 +35,7 @@ buildscript {
}
dependencies {
compile project(":HMCLAPI")
compile project(":HMCUtils")
}
retrolambda {

Some files were not shown because too many files have changed in this diff Show More