Plugin Help Color Player's Name

Discussion in 'Plugin Help/Development/Requests' started by 0verFull, Feb 15, 2015.

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

    0verFull

    How to set the name of a player of an arraylist in color. For example the players of arraylist 'BlueTeam' have their names in Blue.
     
  2. Offline

    timtower Administrator Administrator Moderator

    @0verFull You add ChatColor.BLUE before you add them to the list?
     
  3. Offline

    0verFull

    I add the Player to the arraylist when he click on sign . Can You give me a line of code to set the Name of the Player in color?
     
  4. Offline

    pie_flavor

    @timtower he probably wants it over their head and whatnot.
    @0verFull Use Scoreboard teams. Just add everyone in it to a Team and use Team#setPrefix("§b") or §9 or §1 or whatever.
     
  5. Offline

    0verFull

    And how to make scoreboard team?
     
  6. Offline

    timtower Administrator Administrator Moderator

  7. Offline

    pie_flavor

    @timtower Hey, it works.
    @0verFull
    Code:
    Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
    Team blue = board.getTeam("blue") == null ? board.registerNewTeam("blue") : board.getTeam("blue");
    blue.setPrefix("§b");
     
  8. Offline

    0verFull

    Can use this with arraylist ? Or how to add Player to the team ?
     
  9. Offline

    pie_flavor

    @0verFull
    Code:
    //list is the list of players
    for (Player p : list) {
        blue.addPlayer(p);
    }
     
  10. Offline

    0verFull

    Last edited by a moderator: Feb 15, 2015
Thread Status:
Not open for further replies.

Share This Page