How to "broadcast" to all players

Discussion in 'BungeeCord Plugin Development' started by CraftThatBlock, Feb 12, 2013.

  1. Hello BungeeCord plugin developers, lots of you ask on the IRC: "How can i broadcast stuff to everyone?" The answer is simple. Their is no method is Bungee to do that. You need to sendMessage to all the users. It can be done like so:

    Code (Text):
                for ( ProxiedPlayer player : ProxyServer.getInstance().getPlayers() )
                {
                    player.sendMessage( message );
                }
    Where message is a variable. Like:

    Code (Text):
    String message = "Hello all!";
                for ( ProxiedPlayer player : ProxyServer.getInstance().getPlayers() )
                {
                    player.sendMessage( message );
                }
    Thanks a lot for reading! If you need more help, join the #md_5 IRC channel on EsperNet IRC.