Skip to content

Commit

Permalink
Implement module loader, blacklist this build from loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Jan 13, 2014
1 parent 93cf50b commit a426a5e
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
5 changes: 5 additions & 0 deletions bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public static void main(String[] args) throws Exception
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!" );
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions proxy/src/main/java/net/md_5/bungee/BungeeCord.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();


{
Expand Down Expand Up @@ -187,6 +188,8 @@ public void start() throws Exception
{
ResourceLeakDetector.setEnabled( false ); // Eats performance

moduleManager.load( this );

pluginsFolder.mkdir();
pluginManager.detectPlugins( pluginsFolder );
config.load();
Expand Down
38 changes: 38 additions & 0 deletions proxy/src/main/java/net/md_5/bungee/ModuleManager.java
Original file line number Diff line number Diff line change
@@ -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" ) )
{

}
}
}
}

0 comments on commit a426a5e

Please sign in to comment.