3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Remove ANSI patch from @jrtc27 for now, breaks log strip colours.

Dieser Commit ist enthalten in:
md_5 2013-03-15 20:49:12 +11:00
Ursprung 71978f3a0e
Commit c297cddeb3
5 geänderte Dateien mit 5 neuen und 96 gelöschten Zeilen

Datei anzeigen

@ -1,91 +0,0 @@
From 45cd8d3b26d64220cfb86dac4a07416b2919c5f1 Mon Sep 17 00:00:00 2001
From: James Clarke <jamesrtclarke@me.com>
Date: Sat, 26 Jan 2013 10:39:45 +0000
Subject: [PATCH] ANSI color codes now reset text attributes. Fixes BUKKIT-3508
The client resets all formatting after a color code is received, but currently the ANSI codes do not, and so the console does not accurately reflect the appearance of the formatted text. Instead, the ANSI color codes are now set to reset all text attributes.
---
.../net/minecraft/server/ConsoleLogFormatter.java | 9 ++++--
.../craftbukkit/command/ColouredConsoleSender.java | 34 +++++++++++-----------
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
index 6a58493..e945f7a 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
@@ -13,7 +13,6 @@ final class ConsoleLogFormatter extends Formatter {
private SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// CraftBukkit start - add color stripping, change constructor to take it
- private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]");
private boolean strip = false;
ConsoleLogFormatter(boolean strip) {
@@ -56,7 +55,13 @@ final class ConsoleLogFormatter extends Formatter {
// CraftBukkit start - handle stripping color
if (this.strip) {
- return this.pattern.matcher(stringbuilder.toString()).replaceAll("");
+ StringBuilder line = new StringBuilder();
+ for (char c : stringbuilder.toString().toCharArray()) {
+ if (Character.isLetterOrDigit(c)) {
+ line.append(c);
+ }
+ }
+ return line.toString();
} else {
return stringbuilder.toString();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
index c86253c..3ab8f3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/ColouredConsoleSender.java
@@ -22,28 +22,28 @@ public class ColouredConsoleSender extends CraftConsoleCommandSender {
this.reader = ((CraftServer) getServer()).getReader();
this.terminal = reader.getTerminal();
- replacements.put(ChatColor.BLACK, Ansi.ansi().fg(Ansi.Color.BLACK).boldOff().toString());
- replacements.put(ChatColor.DARK_BLUE, Ansi.ansi().fg(Ansi.Color.BLUE).boldOff().toString());
- replacements.put(ChatColor.DARK_GREEN, Ansi.ansi().fg(Ansi.Color.GREEN).boldOff().toString());
- replacements.put(ChatColor.DARK_AQUA, Ansi.ansi().fg(Ansi.Color.CYAN).boldOff().toString());
- replacements.put(ChatColor.DARK_RED, Ansi.ansi().fg(Ansi.Color.RED).boldOff().toString());
- replacements.put(ChatColor.DARK_PURPLE, Ansi.ansi().fg(Ansi.Color.MAGENTA).boldOff().toString());
- replacements.put(ChatColor.GOLD, Ansi.ansi().fg(Ansi.Color.YELLOW).boldOff().toString());
- replacements.put(ChatColor.GRAY, Ansi.ansi().fg(Ansi.Color.WHITE).boldOff().toString());
- replacements.put(ChatColor.DARK_GRAY, Ansi.ansi().fg(Ansi.Color.BLACK).bold().toString());
- replacements.put(ChatColor.BLUE, Ansi.ansi().fg(Ansi.Color.BLUE).bold().toString());
- replacements.put(ChatColor.GREEN, Ansi.ansi().fg(Ansi.Color.GREEN).bold().toString());
- replacements.put(ChatColor.AQUA, Ansi.ansi().fg(Ansi.Color.CYAN).bold().toString());
- replacements.put(ChatColor.RED, Ansi.ansi().fg(Ansi.Color.RED).bold().toString());
- replacements.put(ChatColor.LIGHT_PURPLE, Ansi.ansi().fg(Ansi.Color.MAGENTA).bold().toString());
- replacements.put(ChatColor.YELLOW, Ansi.ansi().fg(Ansi.Color.YELLOW).bold().toString());
- replacements.put(ChatColor.WHITE, Ansi.ansi().fg(Ansi.Color.WHITE).bold().toString());
+ 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());
+ replacements.put(ChatColor.DARK_GREEN, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).boldOff().toString());
+ replacements.put(ChatColor.DARK_AQUA, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).boldOff().toString());
+ replacements.put(ChatColor.DARK_RED, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).boldOff().toString());
+ replacements.put(ChatColor.DARK_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.MAGENTA).boldOff().toString());
+ replacements.put(ChatColor.GOLD, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).boldOff().toString());
+ replacements.put(ChatColor.GRAY, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).boldOff().toString());
+ replacements.put(ChatColor.DARK_GRAY, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).bold().toString());
+ replacements.put(ChatColor.BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).bold().toString());
+ replacements.put(ChatColor.GREEN, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.GREEN).bold().toString());
+ replacements.put(ChatColor.AQUA, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.CYAN).bold().toString());
+ replacements.put(ChatColor.RED, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.RED).bold().toString());
+ replacements.put(ChatColor.LIGHT_PURPLE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.MAGENTA).bold().toString());
+ replacements.put(ChatColor.YELLOW, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.YELLOW).bold().toString());
+ replacements.put(ChatColor.WHITE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.WHITE).bold().toString());
replacements.put(ChatColor.MAGIC, Ansi.ansi().a(Attribute.BLINK_SLOW).toString());
replacements.put(ChatColor.BOLD, Ansi.ansi().a(Attribute.UNDERLINE_DOUBLE).toString());
replacements.put(ChatColor.STRIKETHROUGH, Ansi.ansi().a(Attribute.STRIKETHROUGH_ON).toString());
replacements.put(ChatColor.UNDERLINE, Ansi.ansi().a(Attribute.UNDERLINE).toString());
replacements.put(ChatColor.ITALIC, Ansi.ansi().a(Attribute.ITALIC).toString());
- replacements.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.DEFAULT).toString());
+ replacements.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET).toString());
}
@Override
--
1.8.1-rc2

Datei anzeigen

@ -1,4 +1,4 @@
From c5a08dfd520da58484fe0f953faa85a4c6f8d545 Mon Sep 17 00:00:00 2001 From 0440a1cf145aa79ef47d3c2db6f096e3d330d266 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sat, 2 Mar 2013 13:34:17 +1100 Date: Sat, 2 Mar 2013 13:34:17 +1100
Subject: [PATCH] Snapshot support. Subject: [PATCH] Snapshot support.

Datei anzeigen

@ -1,4 +1,4 @@
From 5eae34496926939f89cf38aac489c996d6432cf8 Mon Sep 17 00:00:00 2001 From 65e4386d461d313d9de97bc9f27c0e7aaef60dbd Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Sun, 3 Mar 2013 20:22:45 +1100 Date: Sun, 3 Mar 2013 20:22:45 +1100
Subject: [PATCH] Fix crash with exceptions in command block commands. Subject: [PATCH] Fix crash with exceptions in command block commands.

Datei anzeigen

@ -1,4 +1,4 @@
From d1f056b206014ed99fcb565e8bc376d8dc88650c Mon Sep 17 00:00:00 2001 From ac384dd63995c6eb516756b2b0c0b93712038c84 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Mon, 4 Mar 2013 18:45:52 +1100 Date: Mon, 4 Mar 2013 18:45:52 +1100
Subject: [PATCH] PlayerItemDamageEvent Subject: [PATCH] PlayerItemDamageEvent
@ -8,7 +8,7 @@ Subject: [PATCH] PlayerItemDamageEvent
1 file changed, 10 insertions(+), 1 deletion(-) 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 3043db9..8925327 100644 index 3043db9..e3db554 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java --- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -161,7 +161,16 @@ public final class ItemStack { @@ -161,7 +161,16 @@ public final class ItemStack {

Datei anzeigen

@ -1,4 +1,4 @@
From 09f0c0e6b562c09782dbeec2dadd031423f5195d Mon Sep 17 00:00:00 2001 From f4ffbf28426aefbec5fcef262ea3dd5c4133212a Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au> From: md_5 <md_5@live.com.au>
Date: Thu, 7 Mar 2013 20:12:46 +1100 Date: Thu, 7 Mar 2013 20:12:46 +1100
Subject: [PATCH] Thread safety. Adds thread safety for chunk load / unload Subject: [PATCH] Thread safety. Adds thread safety for chunk load / unload