Solved send all players a title

Discussion in 'Plugin Development' started by rexcoder, Oct 1, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    rexcoder

    Hi
    I'm currently making a plugin what makes the vanilla command easier to use. However I've got a problem with the title command. I want to make the command like this: /title <message> <Player> I know thats easy I can also do that but I want to add an extra feature: If you leave the Player arg away the title will appear for every Player.

    So my problem ist I don't know how to send every player a title.

    everybody.sendTitle("top", "bottom");

    The evereybody is where I don't know what to put
     
  2. Online

    timtower Administrator Administrator Moderator

    @creepycode Loop through the players, send the title?
     
  3. Offline

    rexcoder

    @timtower src?
    Im new to developing sorry
     
  4. Online

    timtower Administrator Administrator Moderator

    bwfcwalshy likes this.
  5. Offline

    rexcoder

  6. Offline

    Evonoucono

  7. Offline

    MineStein

    Code:
    for (Player player : Bukkit.getOnlinePlayers()) {
            // send  'player' title
    }
     
  8. @creepycode @MineStein
    You can also do it with Java 8's fancy forEach calls!
    Code:java
    1. Bukkit.getOnlinePlayers().forEach(player -> player.sendTitle(..args..))
     
  9. Offline

    rexcoder

  10. Offline

    Zombie_Striker

    @creepycode
    If your problem has been solved, mark this thread as solved.
     
Thread Status:
Not open for further replies.

Share This Page