How to make all players send a message?

Discussion in 'Spigot Plugin Help' started by MatthewD, Jun 8, 2018.

  1. Any solutions?
     
  2. Loop through all players and make them perform a command which sends a message? Or what do you mean?
     
  3. I want everyone to say a certain message.
     
  4. Just:
    Code (Java):
    Bukkit.getOnlinePlayers().stream().forEach(player -> player.chat("The message you want to send"));
    This is using Java 8's streams. If you want it Java 7 compat, just loop through all online players using an enhanced for-loop.
     
  5. Thank's dude! I use Java 8!