mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 14:13:47 +01:00
Add reason for stopping and extra arguments.
This commit is contained in:
parent
415d5860e4
commit
2055c98ebe
@ -147,6 +147,13 @@ public abstract class ProxyServer
|
||||
*/
|
||||
public abstract void stop();
|
||||
|
||||
/**
|
||||
* Gracefully mark this instance for shutdown.
|
||||
*
|
||||
* @param reason the reason for stopping. This will be shown to players.
|
||||
*/
|
||||
public abstract void stop(String reason);
|
||||
|
||||
/**
|
||||
* Start this instance so that it may accept connections.
|
||||
*
|
||||
|
@ -334,6 +334,12 @@ public class BungeeCord extends ProxyServer
|
||||
|
||||
@Override
|
||||
public void stop()
|
||||
{
|
||||
stop( getTranslation( "restart" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(final String reason)
|
||||
{
|
||||
new Thread( "Shutdown Thread" )
|
||||
{
|
||||
@ -353,7 +359,7 @@ public class BungeeCord extends ProxyServer
|
||||
getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() );
|
||||
for ( UserConnection user : connections.values() )
|
||||
{
|
||||
user.disconnect( getTranslation( "restart" ) );
|
||||
user.disconnect( reason );
|
||||
}
|
||||
} finally
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
@ -18,7 +19,13 @@ public class CommandEnd extends Command
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args)
|
||||
{
|
||||
if ( args.length == 0 )
|
||||
{
|
||||
BungeeCord.getInstance().stop();
|
||||
} else
|
||||
{
|
||||
BungeeCord.getInstance().stop( Joiner.on( ' ' ).join( args ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user