Solved How would you send a message to the whole server?

Discussion in 'Plugin Development' started by RJTech, Nov 1, 2019.

  1. Offline

    RJTech

    I know this kinda sounds dumb, but how would one send a message to all the players online?
    This is how I send a message to a player:

    Player player = (Player) sender;
    player.sendMessage(ChatColor.RED "test message");

    now, how do I do that for the whole server? If I wanted to make a title message to the whole server how can I do that?
     
  2. Offline

    cheeseypotato

    @RJTech Title message as in /title or chat text message because to do that you can do:
    bukkit.broadcastMessage("Text here");
     
  3. Offline

    DerDonut

    The Player class offers a sendTitle method, therefor you have to loop over all online players
     
  4. Offline

    RJTech

    @cheeseypotato both, mainly the title tho. when I try and add that line, it says i need to make bukkit a variable
     
  5. Online

    timtower Moderator Moderator

    @RJTech It is Bukkit, not bukkit for that.
     
  6. Offline

    RJTech

Share This Page