From a64c34d29e74afa97500bd41d4a836af5ed30ddf Mon Sep 17 00:00:00 2001 From: Mariell Hoversholm Date: Wed, 1 Jul 2020 10:59:32 +1000 Subject: [PATCH] #2875: Add the MessageRaw channel --- .../bungee/connection/DownstreamBridge.java | 20 +++++++++++++++++++ 1 file changed, 20 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 147110e4..95922b34 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 @@ -27,6 +27,7 @@ import net.md_5.bungee.ServerConnection.KeepAliveData; import net.md_5.bungee.UserConnection; import net.md_5.bungee.Util; import net.md_5.bungee.api.ProxyServer; +import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.connection.ProxiedPlayer; @@ -435,6 +436,25 @@ public class DownstreamBridge extends PacketHandler } } } + if ( subChannel.equals( "MessageRaw" ) ) + { + String target = in.readUTF(); + BaseComponent[] message = ComponentSerializer.parse( in.readUTF() ); + if ( target.equals( "ALL" ) ) + { + for ( ProxiedPlayer player : bungee.getPlayers() ) + { + player.sendMessage( message ); + } + } else + { + ProxiedPlayer player = bungee.getPlayer( target ); + if ( player != null ) + { + player.sendMessage( message ); + } + } + } if ( subChannel.equals( "GetServer" ) ) { out.writeUTF( "GetServer" );