Solved Changing player name tag colour

Discussion in 'Spigot Plugin Development' started by finnbon, Mar 4, 2017.

  1. Hello people,

    To my knowledge, there is some way to change a player's name tag colour via teams. My only question is, how do I achieve this? I've been googling this question but to no avail. Hopefully any of you does know the solution.

    Thanks in advance.

    - Finn
  2. Do you want a BukkitAPI answer or vanilla Minecraft command answer?
  3. Since we're in the plugin development section, a Bukkit API answer :p
  4. 0. You should know that a player's name plate is something like this:
    Code (Text):
    <scoreboard team prefix>playername<scoreboard team suffix>
    Think this: so what if a team's prefix is a color char?
    Code (Text):
    <color char>playername<scoreboard team suffix>
    1. Since you want a scoreboard team... First get a scoreboard
    Code (Text):
    Scoreboard sb = Bukkit.getScoreboardManager().getMainScoreboard();
    2. Create a team, with a prefix of color char.
    Code (Text):
    Team blueteam = sb.registerNewTeam("BlueNameTeam");
    3. Put a player into the team
    Code (Text):
    Simple as that.
    • Useful Useful x 1
  5. team setPrefix ChatColor color

    Simple as that.
  6. Well that's easier than I expected. This idea did cross my mind but I thought there was some way to set a team's colour too, so I was looking for something like that. But this works, so I'll be using this. Thanks!
  7. Mojang's team color is actually a color char prefix.
  8. [​IMG]
    • Funny Funny x 1