Add KickPlayer subchannel

Can be used to kick a player who is on a different server
This commit is contained in:
Ad237 2014-07-22 14:05:52 +01:00 committed by md_5
parent ee3efd75d7
commit 072e360d0f

View File

@ -6,6 +6,7 @@ import java.io.DataInput;
import java.util.Objects;
import lombok.RequiredArgsConstructor;
import net.md_5.bungee.ServerConnection;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.event.ServerDisconnectEvent;
import net.md_5.bungee.UserConnection;
import net.md_5.bungee.Util;
@ -382,6 +383,15 @@ public class DownstreamBridge extends PacketHandler
out.writeShort( info.getAddress().getPort() );
}
}
if ( subChannel.equals( "KickPlayer" ) )
{
ProxiedPlayer player = bungee.getPlayer( in.readUTF() );
if ( player != null )
{
String kickReason = in.readUTF();
player.disconnect( new TextComponent( kickReason ) );
}
}
// Check we haven't set out to null, and we have written data, if so reply back back along the BungeeCord channel
if ( out != null )