From ef706b064e7c102756c509cfc22626b81dede791 Mon Sep 17 00:00:00 2001 From: Martoph Date: Thu, 23 Apr 2020 11:06:13 +1000 Subject: [PATCH] #655: Added support for the VM tag jansi.passthrough when processing messages sent to a ColouredConsoleSender. --- .../bukkit/craftbukkit/command/ColouredConsoleSender.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java index fdf2f075e2..e0bd5adc19 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java @@ -14,10 +14,12 @@ public class ColouredConsoleSender extends CraftConsoleCommandSender { private final Terminal terminal; private final Map replacements = new EnumMap(ChatColor.class); private final ChatColor[] colors = ChatColor.values(); + private final boolean jansiPassthrough; protected ColouredConsoleSender() { super(); this.terminal = ((CraftServer) getServer()).getReader().getTerminal(); + this.jansiPassthrough = Boolean.getBoolean("jansi.passthrough"); replacements.put(ChatColor.BLACK, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).boldOff().toString()); replacements.put(ChatColor.DARK_BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).boldOff().toString()); @@ -45,7 +47,8 @@ public class ColouredConsoleSender extends CraftConsoleCommandSender { @Override public void sendMessage(String message) { - if (terminal.isAnsiSupported()) { + // support jansi passthrough VM option when jansi doesn't detect an ANSI supported terminal + if (jansiPassthrough || terminal.isAnsiSupported()) { if (!conversationTracker.isConversingModaly()) { String result = message; for (ChatColor color : colors) {