Skip to content

Commit

Permalink
SpigotMC#2875: Add the MessageRaw channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Proximyst authored and md-5 committed Jul 1, 2020
1 parent 1d40b8a commit a64c34d
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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;
Expand Down Expand Up @@ -435,6 +436,25 @@ public void handle(PluginMessage pluginMessage) throws Exception
}
}
}
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" );
Expand Down

0 comments on commit a64c34d

Please sign in to comment.