Implement module loader, blacklist this build from loading.

This commit is contained in:
md_5 2014-01-13 14:28:07 +11:00
parent 93cf50b4e1
commit a426a5ec22
4 changed files with 48 additions and 2 deletions

View File

@ -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!" );

View File

@ -102,8 +102,8 @@
<artifactId>gitdescribe-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<outputPrefix>git-${project.name}-${project.version}-</outputPrefix>
<outputPostfix>-${build.number}</outputPostfix>
<outputPrefix>git:${project.name}:${project.version}:</outputPrefix>
<outputPostfix>:${build.number}</outputPostfix>
</configuration>
<executions>
<execution>

View File

@ -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();

View File

@ -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<ModuleSpec> modules = null;
// TODO: Use filename filter here and in PluginManager
for ( File file : moduleDirectory.listFiles() )
{
if ( file.isFile() && file.getName().endsWith( ".jar" ) )
{
}
}
}
}