Render ANSI terminal colors in the server terminal

What does this MR do and why?

  • Renders any ANSI terminal colors sent by a server. Strips all other ANSI control characters.
  • Adds configuration items to enable ANSI colors, and to keep the original crafty timestamp/log level colors
  • Stylizes links, makes them clickable, and provides a warning to the user that link came from the server and my be untrustworthy. Clickable links can be disabled.
  • New Java servers get the flags needed to render the colors: -Dterminal.ansi=true -Dterminal.jline=false
    • Existing servers will need to have this added manually.
  • Settings are cached, and checks that cannot match a line are skipped. Previously, the config file was checked for each line, hitting the disk and causing a performance bottleneck.
  • This is mostly effective on NeoForge and Paper. Vanilla doesn't use ANSI. I have not tested other servers.

Closes #239 (closed), #402 (closed), and #574 (closed)

Follow up after release: #516 and #612

Screenshots or screen recordings

Screenshot_2026-09-29_163717

Screenshot_2026-09-29_163104

Screenshot_2026-09-29_163121

image

Screenshot_2026-09-18_213103

Screenshot_2026-09-19_192455 Screenshot_2026-09-19_192448

How to set up and validate locally

  1. Build and run a NeoForge server, each log line should be colored by log level according to NeoForge
  2. Spin up a Paper server, install the LuckPerms mod. Colors should be as shown above. NeoForge seems to override the LuckPerms colors.
  3. Click on a link, you should see a popup.
  4. Disable terminal colors and links in the config. Crafty should revert to it's default behavior as seen in v4.11.0 and earlier.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • Have you checked this doesn't interfere/conflict/duplicate someone elses work?
  • Have you fully tested your changes?
  • Have you resolved any lint issues?
  • Have you assigned a reviewer?
  • Have you applied correct labels?
Edited by Andrew

Merge request reports

Loading
Loading