Close #626 - command line argument for version. Also refactors into a bootstrap which warns users when not using Java 7!

This commit is contained in:
md_5
2013-09-25 17:21:03 +10:00
parent 09f123ce9a
commit cbcd874d47
6 changed files with 208 additions and 80 deletions

View File

@@ -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.