From 072e360d0fa5075db174a48280c1a777914bc567 Mon Sep 17 00:00:00 2001 From: Ad237 Date: Tue, 22 Jul 2014 14:05:52 +0100 Subject: [PATCH] Add KickPlayer subchannel Can be used to kick a player who is on a different server --- .../net/md_5/bungee/connection/DownstreamBridge.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index aca6b9b6..3446bab1 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -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 )