Colors in Console not working

Discussion in 'Spigot Plugin Development' started by Swedz, Jun 11, 2016.

  1. I am trying to put some info into the console but it doesn't show up as expected.
    Code (Text):
    Log.info(ChatColor.RED + "hey this is a message!");
    That's the code I'm using, however it just prints out:
    Code (Text):
    [INFO] §chey this is a message!
    It doesn't just show it in red text..

    Edit: Also, just a side question. How can I get it to show the time as well in the [INFO] spot? Because in my console, it says (for example)
    Code (Text):
    [23:03:30 INFO]
    Rather than just [INFO]

    Why is this occurring?
     
  2. Choco

    Moderator

    Not all consoles support colour :p
     
  3. Code (Text):
    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Red text.");
    ;)
     
    • Like Like x 3
  4. Uhhhm okay, but bukkit sure does.

    Thanks, this seems to work for me! However, at the end of the message I do have to do
    Code (Text):
    Ansi.ansi().fg(Ansi.Color.DEFAULT).boldOff().toString()
    So it goes back to normal and doesn't color all text like that from then on.
     
  5. Do this instead, that is nicer.
     
  6. This works even better! Thank you guys so much! :)
     
  7. If you like that, see the link mentioned above, but see my reply in there. Its got some more information ;)
     
    • Like Like x 2
  8. Craftbukkit console does not support Colors in console
    Spigot does support
     
    • Optimistic Optimistic x 1
  9. Incorrect. Its the same console.. ;)
     
  10. I tested it on CraftBukkit did not load in spigot it loaded the colors
     
    • Optimistic Optimistic x 1
  11. @Senneistheboss Are you using the ChatColor enum under the spigot package instead of the bukkit one?
     
  12. No worry i already use Spigot
     
  13. @Senneistheboss that's not what I said. The console is colored on just CraftBukkit servers, too. It's possible that you are importing the ChatColor enum that is located under the org.spigotmc package, instead of the org.bukkit one. If you're using that, it won't work on bukkit.