#1583: Two additions to console behaviour:

1) Stop trying to read anything if the console is hooked up to /dev/null
2) Don't even bother in the first place if --noconsole is used as an argument.
This commit is contained in:
md_5 2015-09-16 15:09:18 +10:00
parent c626254825
commit 8a1030e21c

View File

@ -23,6 +23,7 @@ public class BungeeCordLauncher
OptionParser parser = new OptionParser(); OptionParser parser = new OptionParser();
parser.allowsUnrecognizedOptions(); parser.allowsUnrecognizedOptions();
parser.acceptsAll( Arrays.asList( "v", "version" ) ); parser.acceptsAll( Arrays.asList( "v", "version" ) );
parser.acceptsAll( Arrays.asList( "noconsole" ) );
OptionSet options = parser.parse( args ); OptionSet options = parser.parse( args );
@ -53,10 +54,10 @@ public class BungeeCordLauncher
bungee.getLogger().info( "Enabled BungeeCord version " + bungee.getVersion() ); bungee.getLogger().info( "Enabled BungeeCord version " + bungee.getVersion() );
bungee.start(); bungee.start();
while ( bungee.isRunning ) if ( !options.has( "noconsole" ) )
{ {
String line = bungee.getConsoleReader().readLine( ">" ); String line;
if ( line != null ) while ( bungee.isRunning && ( line = bungee.getConsoleReader().readLine( ">" ) ) != null )
{ {
if ( !bungee.getPluginManager().dispatchCommand( ConsoleCommandSender.getInstance(), line ) ) if ( !bungee.getPluginManager().dispatchCommand( ConsoleCommandSender.getInstance(), line ) )
{ {