diff --git a/bootstrap/nb-configuration.xml b/bootstrap/nb-configuration.xml new file mode 100644 index 00000000..7e465924 --- /dev/null +++ b/bootstrap/nb-configuration.xml @@ -0,0 +1,31 @@ + + + + + + project + NEW_LINE + NEW_LINE + NEW_LINE + true + true + true + true + true + true + true + true + true + true + + diff --git a/bootstrap/pom.xml b/bootstrap/pom.xml new file mode 100644 index 00000000..f2107213 --- /dev/null +++ b/bootstrap/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + + net.md-5 + bungeecord-parent + 1.6.4-SNAPSHOT + ../pom.xml + + + net.md-5 + bungeecord-bootstrap + 1.6.4-SNAPSHOT + jar + + BungeeCord-Bootstrap + Java 1.6 loader for BungeeCord + + + + net.md-5 + bungeecord-proxy + ${project.version} + compile + + + net.sf.jopt-simple + jopt-simple + 4.5 + compile + + + + + BungeeCord + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.6 + 1.6 + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + net.md_5.bungee.Bootstrap + ${describe} + ${maven.build.timestamp} + + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.1 + + + package + + shade + + + + + + + *:* + + **/*.java + **/*.SF + **/*.DSA + + + + + + + + diff --git a/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java b/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java new file mode 100644 index 00000000..686cf17b --- /dev/null +++ b/bootstrap/src/main/java/net/md_5/bungee/Bootstrap.java @@ -0,0 +1,79 @@ +package net.md_5.bungee; + +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; +import java.util.concurrent.TimeUnit; +import joptsimple.OptionParser; +import joptsimple.OptionSet; +import joptsimple.OptionSpec; +import net.md_5.bungee.api.ChatColor; +import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.command.ConsoleCommandSender; + +public class Bootstrap +{ + + private static List list(String... params) + { + return Arrays.asList( params ); + } + + /** + * Starts a new instance of BungeeCord. + * + * @param args command line arguments, currently none are used + * @throws Exception when the server cannot be started + */ + public static void main(String[] args) throws Exception + { + OptionParser parser = new OptionParser(); + parser.acceptsAll( list( "v", "version" ) ); + + OptionSet options = parser.parse( args ); + + if ( options.has( "version" ) ) + { + System.out.println( Bootstrap.class.getPackage().getImplementationVersion() ); + return; + } + + if ( !System.getProperty( "java.version" ).startsWith( "1.7" ) ) + { + System.err.println( "*** ERROR *** BungeeCord requires Java 7 to function!" ); + return; + } + + if ( BungeeCord.class.getPackage().getSpecificationVersion() != null ) + { + Calendar deadline = Calendar.getInstance(); + deadline.add( Calendar.WEEK_OF_YEAR, 2 ); + if ( Calendar.getInstance().after( new SimpleDateFormat( "yyyyMMdd" ).parse( BungeeCord.class.getPackage().getSpecificationVersion() ) ) ) + { + System.err.println( "*** Warning, this build is outdated ***" ); + System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" ); + System.err.println( "*** You will get NO support regarding this build ***" ); + System.err.println( "*** Server will start in 30 seconds ***" ); + Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) ); + } + } + + BungeeCord bungee = new BungeeCord(); + ProxyServer.setInstance( bungee ); + bungee.getLogger().info( "Enabled BungeeCord version " + bungee.getVersion() ); + bungee.start(); + + while ( bungee.isRunning ) + { + String line = bungee.getConsoleReader().readLine( ">" ); + if ( line != null ) + { + if ( !bungee.getPluginManager().dispatchCommand( ConsoleCommandSender.getInstance(), line ) ) + { + bungee.getConsole().sendMessage( ChatColor.RED + "Command not found" ); + } + } + } + } +} diff --git a/pom.xml b/pom.xml index d55ac3e2..83d018bb 100644 --- a/pom.xml +++ b/pom.xml @@ -38,6 +38,7 @@ api + bootstrap config event protocol diff --git a/proxy/pom.xml b/proxy/pom.xml index 3f80db79..91000270 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -80,7 +80,6 @@ - BungeeCord src/main/resources @@ -96,45 +95,6 @@ true - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - net.md_5.bungee.BungeeCord - ${describe} - ${maven.build.timestamp} - - - - - - org.apache.maven.plugins - maven-shade-plugin - 2.1 - - - package - - shade - - - - - - - *:* - - **/*.java - **/*.SF - **/*.DSA - - - - - 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 506915a3..a77b2f8f 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -161,46 +161,6 @@ public class BungeeCord extends ProxyServer } } - /** - * Starts a new instance of BungeeCord. - * - * @param args command line arguments, currently none are used - * @throws Exception when the server cannot be started - */ - public static void main(String[] args) throws Exception - { - if ( BungeeCord.class.getPackage().getSpecificationVersion() != null ) - { - Calendar deadline = Calendar.getInstance(); - deadline.add( Calendar.WEEK_OF_YEAR, 2 ); - if ( Calendar.getInstance().after( new SimpleDateFormat( "yyyyMMdd" ).parse( BungeeCord.class.getPackage().getSpecificationVersion() ) ) ) - { - System.err.println( "*** Warning, this build is outdated ***" ); - System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" ); - System.err.println( "*** You will get NO support regarding this build ***" ); - System.err.println( "*** Server will start in 30 seconds ***" ); - Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) ); - } - } - - BungeeCord bungee = new BungeeCord(); - ProxyServer.setInstance( bungee ); - bungee.getLogger().info( "Enabled BungeeCord version " + bungee.getVersion() ); - bungee.start(); - - while ( bungee.isRunning ) - { - String line = bungee.getConsoleReader().readLine( ">" ); - if ( line != null ) - { - if ( !bungee.getPluginManager().dispatchCommand( ConsoleCommandSender.getInstance(), line ) ) - { - bungee.getConsole().sendMessage( ChatColor.RED + "Command not found" ); - } - } - } - } - /** * Start this proxy instance by loading the configuration, plugins and * starting the connect thread.