#2875: Add the MessageRaw channel

This commit is contained in:
Mariell Hoversholm 2020-07-01 10:59:32 +10:00 committed by md_5
parent 1d40b8a88a
commit a64c34d29e
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -27,6 +27,7 @@ import net.md_5.bungee.ServerConnection.KeepAliveData;
import net.md_5.bungee.UserConnection; import net.md_5.bungee.UserConnection;
import net.md_5.bungee.Util; import net.md_5.bungee.Util;
import net.md_5.bungee.api.ProxyServer; 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.chat.TextComponent;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; 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" ) ) if ( subChannel.equals( "GetServer" ) )
{ {
out.writeUTF( "GetServer" ); out.writeUTF( "GetServer" );