Chat color resetting on new line

Discussion in 'BungeeCord Plugin Help' started by TrollyLoki, Jan 26, 2019.

  1. So I've noticed that whenever a message is sent to a player via player.sendMessage() with a TextComponent any formatting or color codes in the message are reset when the text wraps to a new line in chat. If anyone knows why this is I would really like to know the reason for it. It seems like a really obvious bug so I'm surprised that it hasn't been patched yet. I appreciate any help you can offer.

    P.S. I do realize that I can get around this by just repeating the formatting codes before every word, but that seems like a really bad way to do it.

    Code (Java):
    player.sendMessage(new TextComponent(ChatColor.RED + "This is a long message to be used as an example of how strange this bug is."));
  2. I believe this has something to do with the way Minecraft applies the colors to the string? Not completely sure though it does appear on vanilla servers "hacked" item names.
  3. Its because the client handles a it as a new line. And a new line in the client means new color :)
    Its like sending multiple Lines