Use net.kyori.ansi for console logging (#9313)

Uses the new ANSIComponentSerializer introduced in Adventure 4.14.0 to
serialize components when logging them via the ComponentLogger, or when
sending messages to the console.

This replaces the old solution which uses legacy jank and custom color
conversions, with a new library that handles the conversion and config
This commit is contained in:
Emilia Kond 2023-06-13 01:00:12 +03:00 committed by GitHub
parent 87dfff4cfa
commit 2d09115b3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
425 changed files with 250 additions and 452 deletions

View file

@ -6,18 +6,10 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts
index 9617477e8ef0ef5b1af4733ce4e87ddd796a7be2..e6731ada5a7f0f66322fd958f6244b3d5b8887bf 100644
index 9183b71f6ca78b4a3bc7d804f8d9c4c6db65d5cc..f1fd98bd3d39b4c34043b269e8c43cff073f2726 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -19,6 +19,7 @@ dependencies {
Scanning takes about 1-2 seconds so adding this speeds up the server start.
*/
implementation("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - implementation
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for our Log4j plugins
// Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.19.0") // Paper - remove exclusion
implementation("org.ow2.asm:asm:9.4")
@@ -26,6 +27,7 @@ dependencies {
@@ -28,6 +28,7 @@ dependencies {
testImplementation("org.mockito:mockito-core:4.9.0") // Paper - switch to mockito
implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
@ -25,7 +17,7 @@ index 9617477e8ef0ef5b1af4733ce4e87ddd796a7be2..e6731ada5a7f0f66322fd958f6244b3d
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -105,6 +107,18 @@ tasks.check {
@@ -107,6 +108,18 @@ tasks.check {
}
// Paper end
@ -504,7 +496,7 @@ index 5308f016baf3001ffd1468633cde446493ca581e..1b6d090afea5b0a49b601b73cefeedc0
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 71b395db734c257a64ec3297eebbe52883ea4cc7..072888f891c8e25a2b4daaf561e124930df2be1e 100644
index aaad6b0de19872c6e54591adf90c30d2c2ed5223..6a4c7783146ff6b6703e9ae814134a8d1086cf7f 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -195,6 +195,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -643,7 +635,7 @@ index 383c52c62f49b17db2fbf58009d6ea132d124bea..e0a71bfc1498a517456b21747ab6ef3f
log.log( Level.SEVERE, "\t\t" + stack );
}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index d285dbec16272db6b8a71865e05924ad66087407..1a05d23ff886b015fb9396f119822c678a47ec6f 100644
index 266b4e6fb3988b5848021c83fdc68e342c70b188..2b247d55e39246fbef31279b14c45fc40f956bfb 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -30,10 +30,14 @@