Restart listeners on reload (reloads MOTD too). See issue #157
This commit is contained in:
parent
002f32a879
commit
6afff00da9
@ -163,13 +163,7 @@ public class BungeeCord extends ProxyServer
|
|||||||
|
|
||||||
pluginManager.enablePlugins();
|
pluginManager.enablePlugins();
|
||||||
|
|
||||||
for ( ListenerInfo info : config.getListeners() )
|
startListeners();
|
||||||
{
|
|
||||||
$().info( "Listening on " + info.getHost() );
|
|
||||||
ListenThread listener = new ListenThread( info );
|
|
||||||
listener.start();
|
|
||||||
listeners.add( listener );
|
|
||||||
}
|
|
||||||
|
|
||||||
saveThread.scheduleAtFixedRate( new TimerTask()
|
saveThread.scheduleAtFixedRate( new TimerTask()
|
||||||
{
|
{
|
||||||
@ -183,11 +177,25 @@ public class BungeeCord extends ProxyServer
|
|||||||
new Metrics().start();
|
new Metrics().start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void startListeners()
|
||||||
public void stop()
|
|
||||||
{
|
{
|
||||||
this.isRunning = false;
|
for ( ListenerInfo info : config.getListeners() )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ListenThread listener = new ListenThread( info );
|
||||||
|
listener.start();
|
||||||
|
listeners.add( listener );
|
||||||
|
$().info( "Listening on " + info.getHost() );
|
||||||
|
} catch ( IOException ex )
|
||||||
|
{
|
||||||
|
$().log( Level.SEVERE, "Could not start listener " + info, ex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopListeners()
|
||||||
|
{
|
||||||
for ( ListenThread listener : listeners )
|
for ( ListenThread listener : listeners )
|
||||||
{
|
{
|
||||||
$().log( Level.INFO, "Closing listen thread {0}", listener.socket );
|
$().log( Level.INFO, "Closing listen thread {0}", listener.socket );
|
||||||
@ -200,7 +208,15 @@ public class BungeeCord extends ProxyServer
|
|||||||
$().severe( "Could not close listen thread" );
|
$().severe( "Could not close listen thread" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
listeners.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop()
|
||||||
|
{
|
||||||
|
this.isRunning = false;
|
||||||
|
|
||||||
|
stopListeners();
|
||||||
$().info( "Closing pending connections" );
|
$().info( "Closing pending connections" );
|
||||||
threadPool.shutdown();
|
threadPool.shutdown();
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@ public class CommandReload extends Command
|
|||||||
public void execute(CommandSender sender, String[] args)
|
public void execute(CommandSender sender, String[] args)
|
||||||
{
|
{
|
||||||
BungeeCord.getInstance().config.load();
|
BungeeCord.getInstance().config.load();
|
||||||
|
BungeeCord.getInstance().stopListeners();
|
||||||
|
BungeeCord.getInstance().startListeners();
|
||||||
sender.sendMessage( ChatColor.GREEN + "Reloaded config, please restart if you have any issues" );
|
sender.sendMessage( ChatColor.GREEN + "Reloaded config, please restart if you have any issues" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user