From 8160e299d03cf39fefe8b448ad4d432351f4185f Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 22 Jan 2020 09:33:40 +1100 Subject: [PATCH] Strip ANSI colours from ServerGUI --- nms-patches/ServerGUI.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 nms-patches/ServerGUI.patch diff --git a/nms-patches/ServerGUI.patch b/nms-patches/ServerGUI.patch new file mode 100644 index 0000000000..ea0b0fdb44 --- /dev/null +++ b/nms-patches/ServerGUI.patch @@ -0,0 +1,19 @@ +--- a/net/minecraft/server/ServerGUI.java ++++ b/net/minecraft/server/ServerGUI.java +@@ -159,6 +159,7 @@ + this.e.forEach(Runnable::run); + } + ++ private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); // CraftBukkit + public void a(JTextArea jtextarea, JScrollPane jscrollpane, String s) { + if (!SwingUtilities.isEventDispatchThread()) { + SwingUtilities.invokeLater(() -> { +@@ -174,7 +175,7 @@ + } + + try { +- document.insertString(document.getLength(), s, (AttributeSet) null); ++ document.insertString(document.getLength(), ANSI.matcher(s).replaceAll(""), (AttributeSet) null); // CraftBukkit + } catch (BadLocationException badlocationexception) { + ; + }