Class Ansi

java.lang.Object
mindustry.mod.Mod
mindustry.mod.Plugin
com.xpdustry.ansi.Ansi

public class Ansi extends mindustry.mod.Plugin
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    https://learn.microsoft.com/en-us/windows/console/setconsolemode
    static final int
    https://learn.microsoft.com/en-us/windows/console/setconsolemode
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Enable ANSI escape codes (VT100 for windows) for all console handles (STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE).
    static boolean
    enable(int hConsoleHandle)
    Enable ANSI escape codes (VT100 for windows).
    static String
     
    static void
    Enables ANSI colors and resets escapes codes.
    static void
    Resets ColorCodes fields.

    Methods inherited from class mindustry.mod.Mod

    getConfig, init, loadContent, registerClientCommands, registerServerCommands

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ENABLE_PROCESSED_OUTPUT

      public static final int ENABLE_PROCESSED_OUTPUT
      https://learn.microsoft.com/en-us/windows/console/setconsolemode
      See Also:
    • ENABLE_VIRTUAL_TERMINAL_PROCESSING

      public static final int ENABLE_VIRTUAL_TERMINAL_PROCESSING
      https://learn.microsoft.com/en-us/windows/console/setconsolemode
      See Also:
  • Constructor Details

    • Ansi

      public Ansi()
  • Method Details

    • install

      public static void install()
      Enables ANSI colors and resets escapes codes.
      Does nothing if it's not Windows or if it's the Windows Terminal, which already support colors.
    • enable

      public static boolean enable()
      Enable ANSI escape codes (VT100 for windows) for all console handles (STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE).
      Returns:
      whether the operation has been performed successfully.
      See Also:
    • enable

      public static boolean enable(int hConsoleHandle)
      Enable ANSI escape codes (VT100 for windows).
      Parameters:
      hConsoleHandle - the console handle (STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, STD_ERROR_HANDLE).
      Returns:
      whether the operation has been performed successfully.
      See Also:
    • getLastError

      public static String getLastError()
      Returns:
      a formatted message of the last Windows error.
    • resetColorCodes

      public static void resetColorCodes()
      Resets ColorCodes fields.