Tablist color doesn't work

Discussion in 'Spigot Plugin Development' started by Zeryther, Jun 18, 2015.

  1. Zeryther

    Supporter

    Since days I'm trying to color my player's names in the tablist. I tried p.setPlayerListName() which doesn't work. I also tried Scoreboard Teams, doesn't work. Is this a bug?
     
  2. I'm not sure what you were trying, but this works for me - running Spigot 1.8.7

    Code (Java):

        public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
            if (commandLabel.equalsIgnoreCase("test")){
                if (sender instanceof Player){
                  ((Player) sender).setPlayerListName(ChatColor.GREEN + "Green");
                }
            }
            return true;
         }
     
     
  3. This happens to me on many occasions on many servers, if the server is 1.7 and 1.8 compatible, the colours may not show up for either 1.8 or 1.7, and if that's not the problem, hacked clients can be the cause aswell
     
  4. Zeryther

    Supporter

    I figured out what the problem is: I have the SB Teams in the Main-Board and another Scoreboard showing some game information in a new Scoreboard. If I do

    Code (Java):

    Scoreboard sb = Bukkit.getScoreboardManager().getNewScoreboard();
    p.setScoreboard(sb);
     
    The names become white. I'm still looking for a way to use both scoreboards, as the names become white aswell if the teams aren't in the Main Board.
     
  5. its not recommended to set more than one scoreboard to a player, try merging the two scoreboards together and iff that means the team names in tab list show up as different colors you might just have to live with that or do what you just did which will then break again if anything happens tot he other scoreboard
     
    • Agree Agree x 1
  6. You must p.setPlayerListName("§Color"+p.getName());
     
  7. Zeryther

    Supporter

    Again: That doesn't work.
    I guess I'll have to keep trying.
     
  8. (ChatColor.GREEN + Player.getName());
    if that doesnt work send me the full class please.