mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-25 10:07:38 +01:00
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();
|
||||
|
||||
for ( ListenerInfo info : config.getListeners() )
|
||||
{
|
||||
$().info( "Listening on " + info.getHost() );
|
||||
ListenThread listener = new ListenThread( info );
|
||||
listener.start();
|
||||
listeners.add( listener );
|
||||
}
|
||||
startListeners();
|
||||
|
||||
saveThread.scheduleAtFixedRate( new TimerTask()
|
||||
{
|
||||
@ -183,11 +177,25 @@ public class BungeeCord extends ProxyServer
|
||||
new Metrics().start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
public void startListeners()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
$().log( Level.INFO, "Closing listen thread {0}", listener.socket );
|
||||
@ -200,7 +208,15 @@ public class BungeeCord extends ProxyServer
|
||||
$().severe( "Could not close listen thread" );
|
||||
}
|
||||
}
|
||||
listeners.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
this.isRunning = false;
|
||||
|
||||
stopListeners();
|
||||
$().info( "Closing pending connections" );
|
||||
threadPool.shutdown();
|
||||
|
||||
|
@ -17,6 +17,8 @@ public class CommandReload extends Command
|
||||
public void execute(CommandSender sender, String[] args)
|
||||
{
|
||||
BungeeCord.getInstance().config.load();
|
||||
BungeeCord.getInstance().stopListeners();
|
||||
BungeeCord.getInstance().startListeners();
|
||||
sender.sendMessage( ChatColor.GREEN + "Reloaded config, please restart if you have any issues" );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user