Solved ChatColor not working in Console - Ver.: 1.9.4-R0.1

Discussion in 'Spigot Plugin Development' started by Xearox, May 24, 2016.

  1. Hey there,

    I've some trouble with ChatColor in console messages. In the 1.8 version it's worked perfectly but now I got this here:

    2016-05-24 05_12_37-C__Windows_system32_cmd.exe - ._start.bat.png

    My code in the 1.8 version was just this here and I worked there with Java 7 now with 8.
    Code (Java):
    System.out.println(ChatColor.RED+"This is just a test message");
    plugin.getLogger().info(ChatColor.RED+"This is just a test message");
    But now it's only working with this here:
    Code (Java):
    plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED+"This is just a test");
    Is that correct and if yes, why? I want use the logger to send warnings in red color and this don't work anymore.

    Thank you for your help =)
     
  2. Chat colors never worked in console as far as i'm aware.
     
  3. With
    Code (Java):
    plugin.getServer().getConsoleSender().sendMessage(ChatColor.RED+"This is just a test");
    is it working.
     
  4. Sure it probably converts them for a console sender but not a logger
     
  5. logger is the direct java.util.logger, I don't see why it would interpret chatcolor.

    you can try accessing minecraft's logger, I wouldn't though.
     
  6. Hi! This is because a logger sends basic information such as "<plugin> has loaded with version 1.0, update it!". It's made to send some "quickly" messages and the colour ones are designed to do things that requires more time. (I'm talking about milliseconds!)
     
  7. Very strange. But okay, then I should take the longer way with console sender.