ChatColor Error

Discussion in 'BungeeCord Plugin Development' started by Gamestyler113, May 10, 2015.

Thread Status:
Not open for further replies.
  1. Hello
    I've a problem..
    If I use ChatColors of BungeeCord (with a custom msg).

    Picture 1: http://prntscr.com/73rlg0
    Picture 2: http://prntscr.com/73rlp3

    sorry 4 my bad english! If I reduce my chat (make smaller) .. the message will begin to be white..
    why?
    I try with ChatColor.* and §-Codes..
    I'm using the bungeecord-api..

    is there a bug on my client or how can i fix it?

    please help me
    thanks! :)
     
  2. I don't quite understand the problem your having,
    I will just take a guess and assume your having trouble with colors in general..
    Code (Text):
    String color = ChatColor.RED + "This is a red message..";
     
  3. Teddy has the point.
    ChatColor is one of the most useful and easiest code to use, however with different API's can experience problems (Like you are now).

    Code (Text):
    String color = ChatColor.RED + "This message is RED." // Teddy used a nice example.

    // Or you could use it in examples of code, like if someone creates a sign (event) you can grab the player name through the event and send them a message. I presume it's a command being ran, so this is another good example of using ChatColor (in public Boolean onCommand)

    Player p = (Player)sender;
    p.sendMessage(ChatColor.AQUA + "This is a test message")
    Please, post your code next time. And I do not see why you needed to shade out some of the message if you needed help..

    p.s I'm sorry if I have some spelling / coding errors, I am at school on an iPad :/
     
  4. There is a few ways to make colors in your strings, this is another example.
    Of-course not the best and really pointless but.. there maybe some beginners that are too familiar to the & color symbols.
    Code (Text):
    ChatColor.translateAlternateColorCodes('&', "&cThis is a red message");
     
    • Like Like x 1
  5. Did you actually import
    Code (Text):
    import org.bukkit.ChatColor;
    ?
     
    • Agree Agree x 1
  6. Uses "§"... Red: "§4" , Blue "§9" ...
     
  7. Try
    Code (Text):
    TextComponent message = newTextComponent("Hello world");
    message.setColor( ChatColor.RED);
    message.setBold(true);
    player.sendMessage(message) ;
     
  8. Whats the point of this when this can be achieved in one line of code?
    Code (Text):
    player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Hello World");
    or even
    Code (Text):
    TextComponent message = newTextComponent(ChatColor.RED + "" + ChatColor.BOLD + "Hello World");
    player.sendMessage(message);
     
  9. player.sendMessage(new TextComponent(ChatColor.RED + "" + ChatColor.BOLD + "Hello World"));
     
  10. Inkzzz

    Resource Staff

    You can use the ChatColor#translateAlternateColorCodes();
    - It will show as decapitated but it's fine and works without any errors.
     
  11. Or you can simply type out the & colors like so: ChatColor:
    ChatColor.translateAlternateColorCodes('&', "&4Herro");
     
  12. Inkzzz

    Resource Staff

    Why bump a thread, which is
    A) Already solved.
    B) Around 2 weeks old
     
  13. I didn't read the top, sowwy
     
  14. This resolved?
     
  15. I'm presuming the author was lazy enough to not mark it as solved, so ima put a little report here to see if I can get the thread locked
     
Thread Status:
Not open for further replies.