From a426a5ec225505be59973f73733010fbfb895804 Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 13 Jan 2014 14:28:07 +1100 Subject: [PATCH] Implement module loader, blacklist this build from loading. --- .../main/java/net/md_5/bungee/Bootstrap.java | 5 +++ pom.xml | 4 +- .../main/java/net/md_5/bungee/BungeeCord.java | 3 ++ .../java/net/md_5/bungee/ModuleManager.java | 38 +++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 proxy/src/main/java/net/md_5/bungee/ModuleManager.java diff --git a/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java b/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java index ad0d33c3..8c189336 100644 --- a/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java +++ b/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java @@ -39,6 +39,11 @@ public class Bootstrap return; } + System.out.println( "This version is not ready for production use, please download #788 or below" ); + if (true){ + return; + } + if ( Float.parseFloat( System.getProperty( "java.class.version" ) ) < 51.0 ) { System.err.println( "*** ERROR *** BungeeCord requires Java 7 or above to function!" ); diff --git a/pom.xml b/pom.xml index 4af63711..f83cf813 100644 --- a/pom.xml +++ b/pom.xml @@ -102,8 +102,8 @@ gitdescribe-maven-plugin 1.3 - git-${project.name}-${project.version}- - -${build.number} + git:${project.name}:${project.version}: + :${build.number} diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 20cf0ce1..375e97c1 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -124,6 +124,7 @@ public class BungeeCord extends ProxyServer public final Gson gson = new Gson(); @Getter private ConnectionThrottle connectionThrottle; + private final ModuleManager moduleManager = new ModuleManager(); { @@ -187,6 +188,8 @@ public class BungeeCord extends ProxyServer { ResourceLeakDetector.setEnabled( false ); // Eats performance + moduleManager.load( this ); + pluginsFolder.mkdir(); pluginManager.detectPlugins( pluginsFolder ); config.load(); diff --git a/proxy/src/main/java/net/md_5/bungee/ModuleManager.java b/proxy/src/main/java/net/md_5/bungee/ModuleManager.java new file mode 100644 index 00000000..ce41097e --- /dev/null +++ b/proxy/src/main/java/net/md_5/bungee/ModuleManager.java @@ -0,0 +1,38 @@ +package net.md_5.bungee; + +import java.io.File; +import java.util.List; +import net.md_5.bungee.api.ProxyServer; + +public class ModuleManager +{ + + private class ModuleSpec + { + } + + public void load(ProxyServer proxy) throws Exception + { + String version = proxy.getVersion(); + version = "git:BungeeCord-Proxy:1.7-SNAPSHOT:\"93cf50b\":1337"; + + int lastColon = version.lastIndexOf( ':' ); + int secondLastColon = version.lastIndexOf( ':', lastColon - 1 ); + String buildNumber = version.substring( lastColon + 1, version.length() ); + String gitCommit = version.substring( secondLastColon + 1, lastColon ).replaceAll( "\"", "" ); + + File moduleDirectory = new File( "modules" ); + moduleDirectory.mkdir(); + + List modules = null; + + // TODO: Use filename filter here and in PluginManager + for ( File file : moduleDirectory.listFiles() ) + { + if ( file.isFile() && file.getName().endsWith( ".jar" ) ) + { + + } + } + } +}