mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
Update Adventure to 4.11.0 and implement ComponentLogger (#7937)
This commit is contained in:
parent
3690440aaa
commit
90050ffd54
@ -7,14 +7,14 @@ Co-authored-by: zml <zml@stellardrift.ca>
|
|||||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index f0423df165bf7d0f3fad21d26b64f31ba3e6aeee..6f31679c2944fae3b37847c683abb0d2e5791449 100644
|
index f0423df165bf7d0f3fad21d26b64f31ba3e6aeee..7b8196db1fd1e283dc9ef71e3fe5137cc5920ba9 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -8,17 +8,36 @@ java {
|
@@ -8,17 +8,37 @@ java {
|
||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
+val adventureVersion = "4.10.1"
|
+val adventureVersion = "4.11.0"
|
||||||
+val apiAndDocs: Configuration by configurations.creating {
|
+val apiAndDocs: Configuration by configurations.creating {
|
||||||
+ attributes {
|
+ attributes {
|
||||||
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||||
@ -45,10 +45,11 @@ index f0423df165bf7d0f3fad21d26b64f31ba3e6aeee..6f31679c2944fae3b37847c683abb0d2
|
|||||||
+ apiAndDocs("net.kyori:adventure-text-serializer-gson")
|
+ apiAndDocs("net.kyori:adventure-text-serializer-gson")
|
||||||
+ apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
+ apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||||
+ apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
+ apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||||
|
+ apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
compileOnly("org.apache.maven:maven-resolver-provider:3.8.5")
|
||||||
@@ -77,9 +96,24 @@ tasks.withType<Javadoc> {
|
@@ -77,9 +97,24 @@ tasks.withType<Javadoc> {
|
||||||
"https://guava.dev/releases/31.0.1-jre/api/docs/",
|
"https://guava.dev/releases/31.0.1-jre/api/docs/",
|
||||||
"https://javadoc.io/doc/org.yaml/snakeyaml/1.30/",
|
"https://javadoc.io/doc/org.yaml/snakeyaml/1.30/",
|
||||||
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations
|
"https://javadoc.io/doc/org.jetbrains/annotations/23.0.0/", // Paper - we don't want Java 5 annotations
|
||||||
@ -3996,6 +3997,24 @@ index 228421154913116069c20323afb519bdde2134df..26791db3c267670d5782f1d2b67ff7d5
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||||
|
index 03ca87a1cbace2459174bb7bb8847bda766e80c5..b37938745f916b5f0111b07b1a1c97527f026e9d 100644
|
||||||
|
--- a/src/main/java/org/bukkit/plugin/Plugin.java
|
||||||
|
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||||
|
@@ -179,6 +179,13 @@ public interface Plugin extends TabExecutor {
|
||||||
|
@NotNull
|
||||||
|
public Logger getLogger();
|
||||||
|
|
||||||
|
+ // Paper start - Adventure component logger
|
||||||
|
+ @NotNull
|
||||||
|
+ default net.kyori.adventure.text.logger.slf4j.ComponentLogger getComponentLogger() {
|
||||||
|
+ return net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(getLogger().getName());
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Returns the name of the plugin.
|
||||||
|
* <p>
|
||||||
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
|
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
|
||||||
index ff3fcb2697eb00736238d0efdcaefe43043334d3..75acd6f8f3d774bb79e8e513125e801c5569a244 100644
|
index ff3fcb2697eb00736238d0efdcaefe43043334d3..75acd6f8f3d774bb79e8e513125e801c5569a244 100644
|
||||||
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
|
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
|
||||||
|
@ -6,13 +6,13 @@ Subject: [PATCH] Use ASM for event executors.
|
|||||||
Uses method handles for private or static methods.
|
Uses method handles for private or static methods.
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 6f31679c2944fae3b37847c683abb0d2e5791449..733fed7b0a7259a831e976d443b907830703bda6 100644
|
index 7b8196db1fd1e283dc9ef71e3fe5137cc5920ba9..f0f8047cb3a43b447dc50b730dab3d0bc471b25a 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -38,6 +38,9 @@ dependencies {
|
@@ -39,6 +39,9 @@ dependencies {
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-gson")
|
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||||
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
+
|
+
|
||||||
+ implementation("org.ow2.asm:asm:9.2")
|
+ implementation("org.ow2.asm:asm:9.2")
|
||||||
+ implementation("org.ow2.asm:asm-commons:9.2")
|
+ implementation("org.ow2.asm:asm-commons:9.2")
|
||||||
|
@ -60,7 +60,7 @@ index 91fc11dda99de506be83d40df8929bf7cd8e8d85..7dc631ebd009f5f5c3ac1699c3f3515c
|
|||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||||
index 50ac6f0374da5697a38ef5ec7625da91d4a4276c..f607c57275958bf1cbf8e77b4d7efa936064c228 100644
|
index 2cf43eac30187a43a01c81b3021b2cfec0d4ba8a..864941be2d07de08f63e740ad2becf1dc5790433 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||||
@@ -21,6 +21,11 @@ import org.jetbrains.annotations.Nullable;
|
@@ -21,6 +21,11 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
@ -14,25 +14,25 @@ it without having to shade it in the plugin and going through
|
|||||||
several layers of logging abstraction.
|
several layers of logging abstraction.
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 733fed7b0a7259a831e976d443b907830703bda6..921b301de020ce73126ca518556b3435e776783d 100644
|
index f0f8047cb3a43b447dc50b730dab3d0bc471b25a..435db1ffe47476bcb7067802faad7aee7e4c3f54 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -38,6 +38,8 @@ dependencies {
|
@@ -39,6 +39,8 @@ dependencies {
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-gson")
|
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
apiAndDocs("net.kyori:adventure-text-serializer-legacy")
|
||||||
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
apiAndDocs("net.kyori:adventure-text-serializer-plain")
|
||||||
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
+ api("org.apache.logging.log4j:log4j-api:2.17.1")
|
+ api("org.apache.logging.log4j:log4j-api:2.17.1")
|
||||||
+ api("org.slf4j:slf4j-api:1.8.0-beta4")
|
+ api("org.slf4j:slf4j-api:1.8.0-beta4")
|
||||||
|
|
||||||
implementation("org.ow2.asm:asm:9.2")
|
implementation("org.ow2.asm:asm:9.2")
|
||||||
implementation("org.ow2.asm:asm-commons:9.2")
|
implementation("org.ow2.asm:asm-commons:9.2")
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
|
diff --git a/src/main/java/org/bukkit/plugin/Plugin.java b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||||
index 03ca87a1cbace2459174bb7bb8847bda766e80c5..34438b5362b0ba0949625d81e8371fe0d1f76fdf 100644
|
index b37938745f916b5f0111b07b1a1c97527f026e9d..08aef59d8443038771704d9587e31f299e587307 100644
|
||||||
--- a/src/main/java/org/bukkit/plugin/Plugin.java
|
--- a/src/main/java/org/bukkit/plugin/Plugin.java
|
||||||
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
|
+++ b/src/main/java/org/bukkit/plugin/Plugin.java
|
||||||
@@ -179,6 +179,22 @@ public interface Plugin extends TabExecutor {
|
@@ -186,6 +186,22 @@ public interface Plugin extends TabExecutor {
|
||||||
@NotNull
|
}
|
||||||
public Logger getLogger();
|
// Paper end
|
||||||
|
|
||||||
+ // Paper start - Add SLF4J/Log4J loggers
|
+ // Paper start - Add SLF4J/Log4J loggers
|
||||||
+ @NotNull
|
+ @NotNull
|
||||||
|
@ -9,7 +9,7 @@ a ton of noise to plugin developers.
|
|||||||
These do not help plugin developers if they bring moise noise than value.
|
These do not help plugin developers if they bring moise noise than value.
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index 9bd83fc81ae5a196a7254a4fd68f884805d5bddb..3a011b6fe654da9710aa81c4e13e9b135fbecfc3 100644
|
index f4e1ea578bae0d1dc8badfcbf83ca4550a41867b..ba0c757346975af6fae9c0ebd72487395c74170d 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -1177,10 +1177,8 @@ public final class Bukkit {
|
@@ -1177,10 +1177,8 @@ public final class Bukkit {
|
||||||
@ -159,7 +159,7 @@ index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da4
|
|||||||
CRACKED(0x0),
|
CRACKED(0x0),
|
||||||
GLYPHED(0x1),
|
GLYPHED(0x1),
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index b8ed8d5d48cb4f1b2f598e2c48e4423ab2d899f4..102ce4e488d5b6fd4a19766e9fa02d29075b2c33 100644
|
index 475fe51ff7a9f1c1ed5048ea59d6d8ba73f2903c..911b26247b3cd5e80c1f0a904ad3f88761091551 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -982,10 +982,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -982,10 +982,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add tick times API
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index 5880fe78b52cab2e9c2e4f2639570e0380dd9b73..3b60fa65686572fdd8fab22cd131ca5cfe5274c8 100644
|
index 346ed194262c045bb12034b1dc949cf9bbbcb4ee..00dce49d4053ce0a10cc9d0a40f90e4ab615cdf1 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -1917,6 +1917,25 @@ public final class Bukkit {
|
@@ -1917,6 +1917,25 @@ public final class Bukkit {
|
||||||
@ -35,7 +35,7 @@ index 5880fe78b52cab2e9c2e4f2639570e0380dd9b73..3b60fa65686572fdd8fab22cd131ca5c
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index ad1d73940908f4f20a4944e81b186739fded20ab..6fe653a2a0fd4f07d39ed584bc11688d4926d54e 100644
|
index 97149dc0142bd910681b8f013803fb3ea9f72dbb..b549cb954e4fb4e37277303911d174bedd0ee27d 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -1614,6 +1614,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -1614,6 +1614,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index 4b2f3e674e634efa42f6840933dd9ee9595d036b..7e422716841d3736cce4f0968121231f9c6c33d3 100644
|
index 722d06447522d0ad3b2b52bc73e4259761128e77..f53d436374e360150e17191625ab4277a2ff4d6e 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -1207,6 +1207,27 @@ public final class Bukkit {
|
@@ -1207,6 +1207,27 @@ public final class Bukkit {
|
||||||
@ -37,7 +37,7 @@ index 4b2f3e674e634efa42f6840933dd9ee9595d036b..7e422716841d3736cce4f0968121231f
|
|||||||
* Gets the player by the given UUID, regardless if they are offline or
|
* Gets the player by the given UUID, regardless if they are offline or
|
||||||
* online.
|
* online.
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index a7ba813396fab77bed292422f881b5a0952972fb..afed6bcf923166065ac9f63dd96191cd42eefcb9 100644
|
index f2fbbb6ec88357779258a2798dfdb062789803df..aee2ef29628e05636c705e126eb2bd207f0db378 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -1006,6 +1006,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -1006,6 +1006,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index 3e3e48f467eef561eeada98c6b99388e23595d7f..32d346fb12c976253a3731df6613983f01a9ebb5 100644
|
index c8efb995bdff6e0888ef479aef4cca3e2d66e34c..c2a1df187ca352de24bdc7f76ed667d22ea7a49d 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -1861,6 +1861,24 @@ public final class Bukkit {
|
@@ -1861,6 +1861,24 @@ public final class Bukkit {
|
||||||
@ -34,7 +34,7 @@ index 3e3e48f467eef561eeada98c6b99388e23595d7f..32d346fb12c976253a3731df6613983f
|
|||||||
* Creates a boss bar instance to display to players. The progress
|
* Creates a boss bar instance to display to players. The progress
|
||||||
* defaults to 1.0
|
* defaults to 1.0
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 2409c0023f90689399c8ceba179b800156d16eea..64e4667efbf60204076ef32d64aa3a76c399df05 100644
|
index 09d72432cd854b929b262112921370138344e39c..5a31967313fa96989091f3cd2d4c3184e00e593e 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -1564,6 +1564,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -1564,6 +1564,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] API for creating command sender which forwards feedback
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index 32d346fb12c976253a3731df6613983f01a9ebb5..7fcb2d84e707576531ddb9a7dd85cf0481ae58ce 100644
|
index c2a1df187ca352de24bdc7f76ed667d22ea7a49d..e5271098b97b330566df9a0e11e3b05d5c6b3c8a 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -1392,6 +1392,20 @@ public final class Bukkit {
|
@@ -1392,6 +1392,20 @@ public final class Bukkit {
|
||||||
@ -30,7 +30,7 @@ index 32d346fb12c976253a3731df6613983f01a9ebb5..7fcb2d84e707576531ddb9a7dd85cf04
|
|||||||
* Gets the folder that contains all of the various {@link World}s.
|
* Gets the folder that contains all of the various {@link World}s.
|
||||||
*
|
*
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 64e4667efbf60204076ef32d64aa3a76c399df05..5aa14f6c2f5be4d72689d764ad4d0ce5a3d704a8 100644
|
index 5a31967313fa96989091f3cd2d4c3184e00e593e..99821da965069d54820bbbe349ab5dc09226f450 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -1162,6 +1162,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -1162,6 +1162,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
|
@ -772,6 +772,31 @@ index 0000000000000000000000000000000000000000..2a08e0461db4e699b7e6a1558a4419c8
|
|||||||
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serializer().toJsonTree(component));
|
+ return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serializer().toJsonTree(component));
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..c3631efda9c7fa531a8a9f18fbee7b5f8655382b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
||||||
|
@@ -0,0 +1,19 @@
|
||||||
|
+package io.papermc.paper.adventure.providers;
|
||||||
|
+
|
||||||
|
+import io.papermc.paper.adventure.PaperAdventure;
|
||||||
|
+import net.kyori.adventure.text.Component;
|
||||||
|
+import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||||
|
+import net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+import org.slf4j.LoggerFactory;
|
||||||
|
+
|
||||||
|
+public class ComponentLoggerProviderImpl implements ComponentLoggerProvider {
|
||||||
|
+ @Override
|
||||||
|
+ public @NotNull ComponentLogger logger(@NotNull LoggerHelper helper, @NotNull String name) {
|
||||||
|
+ return helper.delegating(LoggerFactory.getLogger(name), this::serialize);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private String serialize(final Component message) {
|
||||||
|
+ return PaperAdventure.asPlain(message, null);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/adventure/providers/GsonComponentSerializerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/GsonComponentSerializerProviderImpl.java
|
diff --git a/src/main/java/io/papermc/paper/adventure/providers/GsonComponentSerializerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/GsonComponentSerializerProviderImpl.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..c620d5aa2b0208b769dbe9563f0e99edc9a91047
|
index 0000000000000000000000000000000000000000..c620d5aa2b0208b769dbe9563f0e99edc9a91047
|
||||||
@ -3729,6 +3754,13 @@ index 838d5b877c01be3ef353f434d98e27b46c0a3fb4..5c4c0ba05f10d2d83b22d3e86805cfa8
|
|||||||
HashSet<Player> reference = new HashSet<Player>(players.size());
|
HashSet<Player> reference = new HashSet<Player>(players.size());
|
||||||
for (ServerPlayer player : players) {
|
for (ServerPlayer player : players) {
|
||||||
reference.add(player.getBukkitEntity());
|
reference.add(player.getBukkitEntity());
|
||||||
|
diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider b/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..399bde6e57cd82b50d3ebe0f51a3958fa2d52d43
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+io.papermc.paper.adventure.providers.ComponentLoggerProviderImpl
|
||||||
diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.minimessage.MiniMessage$Provider b/src/main/resources/META-INF/services/net.kyori.adventure.text.minimessage.MiniMessage$Provider
|
diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.minimessage.MiniMessage$Provider b/src/main/resources/META-INF/services/net.kyori.adventure.text.minimessage.MiniMessage$Provider
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..6ce632b6c9dc5e4b3b978331df51c0ffd1526471
|
index 0000000000000000000000000000000000000000..6ce632b6c9dc5e4b3b978331df51c0ffd1526471
|
||||||
|
@ -6,35 +6,62 @@ Subject: [PATCH] Add support for hex color codes in console
|
|||||||
Converts upstream's hex color code legacy format into actual hex color codes in the console.
|
Converts upstream's hex color code legacy format into actual hex color codes in the console.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
||||||
index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..709f2a420ceaffe0101c676ec23e949e8d684465 100644
|
index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..8f07539a82f449ad217e316a7513a1708781fb63 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
--- a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
+++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java
|
||||||
@@ -1,5 +1,10 @@
|
@@ -1,16 +1,25 @@
|
||||||
package com.destroystokyo.paper.console;
|
package com.destroystokyo.paper.console;
|
||||||
|
|
||||||
+import io.papermc.paper.console.HexFormattingConverter;
|
|
||||||
+import net.kyori.adventure.audience.MessageType;
|
+import net.kyori.adventure.audience.MessageType;
|
||||||
+import net.kyori.adventure.identity.Identity;
|
+import net.kyori.adventure.identity.Identity;
|
||||||
+import net.kyori.adventure.text.Component;
|
+import net.kyori.adventure.text.Component;
|
||||||
|
+import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||||
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
-import org.apache.logging.log4j.Logger;
|
||||||
import org.bukkit.craftbukkit.command.CraftConsoleCommandSender;
|
import org.bukkit.craftbukkit.command.CraftConsoleCommandSender;
|
||||||
@@ -10,8 +15,13 @@ public class TerminalConsoleCommandSender extends CraftConsoleCommandSender {
|
|
||||||
|
public class TerminalConsoleCommandSender extends CraftConsoleCommandSender {
|
||||||
|
|
||||||
|
- private static final Logger LOGGER = LogManager.getRootLogger();
|
||||||
|
+ private static final ComponentLogger LOGGER = ComponentLogger.logger(LogManager.getRootLogger().getName());
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendRawMessage(String message) {
|
public void sendRawMessage(String message) {
|
||||||
- // TerminalConsoleAppender supports color codes directly in log messages
|
- // TerminalConsoleAppender supports color codes directly in log messages
|
||||||
- LOGGER.info(message);
|
|
||||||
+ final Component msg = LegacyComponentSerializer.legacySection().deserialize(message);
|
+ final Component msg = LegacyComponentSerializer.legacySection().deserialize(message);
|
||||||
+ this.sendMessage(Identity.nil(), msg, MessageType.SYSTEM);
|
+ this.sendMessage(Identity.nil(), msg, MessageType.SYSTEM);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void sendMessage(Identity identity, Component message, MessageType type) {
|
+ public void sendMessage(Identity identity, Component message, MessageType type) {
|
||||||
+ LOGGER.info(HexFormattingConverter.SERIALIZER.serialize(message));
|
LOGGER.info(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
||||||
|
index c3631efda9c7fa531a8a9f18fbee7b5f8655382b..9a3c1314d5a0aa20380662595359580b1a97be89 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
|
||||||
|
@@ -1,9 +1,11 @@
|
||||||
|
package io.papermc.paper.adventure.providers;
|
||||||
|
|
||||||
|
-import io.papermc.paper.adventure.PaperAdventure;
|
||||||
|
+import io.papermc.paper.console.HexFormattingConverter;
|
||||||
|
+import java.util.Locale;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
|
||||||
|
import net.kyori.adventure.text.logger.slf4j.ComponentLoggerProvider;
|
||||||
|
+import net.kyori.adventure.translation.GlobalTranslator;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@@ -14,6 +16,6 @@ public class ComponentLoggerProviderImpl implements ComponentLoggerProvider {
|
||||||
|
}
|
||||||
|
|
||||||
|
private String serialize(final Component message) {
|
||||||
|
- return PaperAdventure.asPlain(message, null);
|
||||||
|
+ return HexFormattingConverter.SERIALIZER.serialize(GlobalTranslator.render(message, Locale.getDefault()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
|
diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
@ -255,7 +282,7 @@ index 0000000000000000000000000000000000000000..f39ae450e316255d315aeb362bf967ea
|
|||||||
+
|
+
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 49f481d34eec97c2bd4f0780e97ce2d41ed04b34..57924d8f2ddac1e7c0c151c4813a2a5ca17e58b8 100644
|
index 9e943c5d3a5ee91bc8a3f77d14e1413d0a1ecdb7..d61acd95810f735245b15555f9bf2022e5bc3683 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1670,7 +1670,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1670,7 +1670,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
Loading…
Reference in New Issue
Block a user