From 750049fa2b03d3880b17431625f96e1044bc7b9d Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 10 May 2021 20:47:51 -0700 Subject: [PATCH] Fix incorrect colors in some log messages (#5609) CraftChatMessage.fromComponent fails to take into account the style of TranslatableComponent args, causing any styling on args to be completely ignored. Fixing this is relatively simple, however would cause behavior to deviate from upstream. This commit will fix the coloring in messages logged through MinecraftServer.LOGGER by simply using Adventure's legacy text serializer, which properly serializes TranslatableComponents and their arguments. Note that this doesn't do anything about the underlying issue of CraftChatMessage.fromComponent improperly serializing TranslatableComponents. --- ...oleAppender-for-console-improvements.patch | 24 ++++++++++----- ...nt-extended-PaperServerListPingEvent.patch | 4 +-- ...dd-Early-Warning-Feature-to-WatchDog.patch | 6 ++-- ...er-Thread-Pool-and-Thread-Priorities.patch | 4 +-- .../0307-Optimize-World-Time-Updates.patch | 4 +-- .../0341-Server-Tick-Events.patch | 6 ++-- ...isPrimaryThread-and-MinecraftServer-.patch | 4 +-- ...le-Keep-Spawn-Loaded-range-per-world.patch | 6 ++-- .../0362-incremental-chunk-saving.patch | 10 +++---- ...69-Asynchronous-chunk-IO-and-loading.patch | 6 ++-- ...if-we-have-a-custom-Bukkit-generator.patch | 6 ++-- .../0389-Optimize-Hoppers.patch | 6 ++-- .../0410-Make-the-GUI-graph-fancier.patch | 4 +-- .../0428-Increase-Light-Queue-Size.patch | 4 +-- ...asks-Speed-up-processing-of-chunk-lo.patch | 18 +++++------ ...-Add-tick-times-API-and-mspt-command.patch | 8 ++--- .../0437-Improved-Watchdog-Support.patch | 30 +++++++++---------- ...tance-map-to-optimise-entity-tracker.patch | 6 ++-- ...Wait-for-Async-Tasks-during-shutdown.patch | 6 ++-- ...ld-Difficulty-Remembering-Difficulty.patch | 4 +-- .../0539-Incremental-player-saving.patch | 4 +-- .../0566-Cache-block-data-strings.patch | 4 +-- ...-non-whitelisted-player-when-white-l.patch | 4 +-- ...g-for-servers-not-running-on-Java-11.patch | 6 ++-- ...5-Added-ServerResourcesReloadedEvent.patch | 8 ++--- .../0665-EntityMoveEvent.patch | 10 +++---- .../0673-misc-debugging-dumps.patch | 14 ++++----- ...telist-use-configurable-kick-message.patch | 4 +-- 28 files changed, 114 insertions(+), 106 deletions(-) diff --git a/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch index d0f943e421..093316448f 100644 --- a/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -143,10 +143,18 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d92ca78e483b3f085e3bad1d1250cac2f9031fa7..62ee4708a3196cfa395317a6312b3ac6c036793a 100644 +index d92ca78e483b3f085e3bad1d1250cac2f9031fa7..bad6dfcb9ed558499c39880c44ae514ee2051a3c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -160,7 +160,7 @@ import org.apache.logging.log4j.Logger; +@@ -12,6 +12,7 @@ import com.mojang.datafixers.DataFixer; + import io.netty.buffer.ByteBuf; + import io.netty.buffer.ByteBufOutputStream; + import io.netty.buffer.Unpooled; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import it.unimi.dsi.fastutil.longs.LongIterator; + import java.awt.image.BufferedImage; + import java.io.BufferedWriter; +@@ -160,7 +161,7 @@ import org.apache.logging.log4j.Logger; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.Lifecycle; import com.google.common.collect.ImmutableSet; @@ -155,7 +163,7 @@ index d92ca78e483b3f085e3bad1d1250cac2f9031fa7..62ee4708a3196cfa395317a6312b3ac6 import joptsimple.OptionSet; import net.minecraft.nbt.DynamicOpsNBT; import net.minecraft.nbt.NBTBase; -@@ -255,7 +255,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; -@@ -324,7 +324,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { this.T = i; this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount())); diff --git a/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch index 7a28855e07..09050bf5bd 100644 --- a/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch @@ -36,10 +36,10 @@ index bd508025b771424c942fd856c31d520b6f548082..62621562137cba4804f0465c58d25ca2 public static int tabSpamLimit = 500; private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index dbf5a849358158324e8a5c87f831236b71f7ec0d..1733717b7cae3e7a805e5275ff89967744c4bc4a 100644 +index 925dd2dc2b4af5596c9dc891f756bad66baadbea..540250a9610e2ee51685b655a7d6c0809bba64fd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1018,6 +1018,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; @@ -40,7 +40,7 @@ index 4605b26cedbd0478b41e976f4b48ad78f12e37ff..4da16809f8f084fc4af4c50b5232914e public CommandDispatcher vanillaCommandDispatcher; private boolean forceTicks; // CraftBukkit end -@@ -1257,14 +1258,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper diff --git a/Spigot-Server-Patches/0410-Make-the-GUI-graph-fancier.patch b/Spigot-Server-Patches/0410-Make-the-GUI-graph-fancier.patch index 7c19039ff5..ca39b7b640 100644 --- a/Spigot-Server-Patches/0410-Make-the-GUI-graph-fancier.patch +++ b/Spigot-Server-Patches/0410-Make-the-GUI-graph-fancier.patch @@ -396,10 +396,10 @@ index 46d82c1548088b8305f758699388edf0d5d4d050..397194b3e90c9df39cfae17b401c7ac8 consumer.accept(t0); return t0; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index af7bef41d341218f25943eb1e10831cc0be6840a..dc817d7c7187de2b37485bef126fb0765a5caf63 100644 +index 94525c8bd49334fb5aa1b113ed992e857e44ab96..c86c3cdea77369e3297548c8d5f10674c1100f76 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -217,7 +217,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { @@ -108,7 +108,7 @@ index 4218dcb90c36bbac35ef292be32972e0fc22e6d2..18d078f85acf33e55e77758746f789af return !this.canOversleep(); }); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -@@ -1319,13 +1338,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant S a(Function function) { AtomicReference atomicreference = new AtomicReference(); Thread thread = new Thread(() -> { -@@ -852,6 +854,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { CompletableFuture completablefuture; diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index ae99f3fb3a4b37c737fb276590004b2e10beab5a..06fa9b91cc103a5d5f39ab8fcfb5ccad4cf0e5de 100644 +index cfe784560ea4c368d6e3a0797d09c0a717eb146e..795c4a9e3e33660af888ff80204bfd47a3b327fd 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -177,7 +177,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { diff --git a/Spigot-Server-Patches/0466-Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/0466-Use-distance-map-to-optimise-entity-tracker.patch index 0947892593..2866b18311 100644 --- a/Spigot-Server-Patches/0466-Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/0466-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5c7ded8244187d993d8dda4afff95d9cfc45579b..25cb877dc3879ff5a1bfaf616ba9942f951eba10 100644 +index 6f51409bac9c2907a5be02e4c15319fcc520609f..e25539dd54956225e8b14d3b8c636130267f226d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1652,6 +1652,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant list = this.tracker.getPassengers(); diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java -index 216723730f151a1da73743ad7c6c31bbdb9890f0..67bea47a2248d228fd070bc0aa66f05b71a76ef5 100644 +index d509cfd2da99233e5142abd176cc50ccea7c32b6..9fc74f08b912ff885c9478167c7ef173c32f1654 100644 --- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -61,6 +61,7 @@ import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; diff --git a/Spigot-Server-Patches/0475-Wait-for-Async-Tasks-during-shutdown.patch b/Spigot-Server-Patches/0475-Wait-for-Async-Tasks-during-shutdown.patch index e9b6d87ebb..825e7a84ce 100644 --- a/Spigot-Server-Patches/0475-Wait-for-Async-Tasks-during-shutdown.patch +++ b/Spigot-Server-Patches/0475-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 25cb877dc3879ff5a1bfaf616ba9942f951eba10..5b9f03f3118e6d19ed5c3d41a94b06172d594a81 100644 +index e25539dd54956225e8b14d3b8c636130267f226d..9074646e8111c69c4875b0633a424b250a30bc5c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -892,6 +892,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down //MinecraftServer.LOGGER.debug("Autosave started"); // Paper serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper diff --git a/Spigot-Server-Patches/0566-Cache-block-data-strings.patch b/Spigot-Server-Patches/0566-Cache-block-data-strings.patch index dfbe6fe8ef..f09196d5d6 100644 --- a/Spigot-Server-Patches/0566-Cache-block-data-strings.patch +++ b/Spigot-Server-Patches/0566-Cache-block-data-strings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 483abe5b3c0c00ebdea405e9bb24509f743bfc2c..ef980b8cba0e30fc65b119d08a034ced7fdb2bc8 100644 +index bd6b9c7be8951393e7ba731f4d6a9486f0743be7..040933a25f1fa88e86b19ea20f519488af6a2740 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1953,6 +1953,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { -@@ -1075,6 +1076,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { -@@ -1934,7 +1932,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant completablefuture = CompletableFuture.supplyAsync(() -> { Stream stream = collection.stream(); // CraftBukkit - decompile error ResourcePackRepository resourcepackrepository = this.resourcePackRepository; -@@ -1950,6 +1954,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper @@ -25,7 +25,7 @@ index 0ff63eede271b555e9de9b61dc76045d450cd990..697ce13c7c32e4badcd171c1e9eefc49 this.methodProfiler.a(() -> { diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java -index c38ef337f9a662d689994a0d530e8e655b843177..bab75b2232f1fa1def09517610179ca1529d195e 100644 +index 530963c1435985e17d0e3181c2d8affe003f81de..c7a661d4f43fad04ebada1bbebf4e4274fc9c452 100644 --- a/src/main/java/net/minecraft/server/level/WorldServer.java +++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -213,6 +213,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { diff --git a/Spigot-Server-Patches/0673-misc-debugging-dumps.patch b/Spigot-Server-Patches/0673-misc-debugging-dumps.patch index 02b602485b..1e707949f1 100644 --- a/Spigot-Server-Patches/0673-misc-debugging-dumps.patch +++ b/Spigot-Server-Patches/0673-misc-debugging-dumps.patch @@ -29,18 +29,18 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 697ce13c7c32e4badcd171c1e9eefc49620ae525..84c3110ea03f9121fc4ab0aaa80ddad5efe28e5c 100644 +index 952d5c7c3324377e0036b9d7e524484cb581e5b2..a116156236caa22d3ee13b5a56f4ed3c8d013f37 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -13,6 +13,7 @@ import io.netty.buffer.ByteBuf; - import io.netty.buffer.ByteBufOutputStream; +@@ -14,6 +14,7 @@ import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; + import io.papermc.paper.adventure.PaperAdventure; // Paper import io.papermc.paper.event.entity.EntityMoveEvent; +import io.papermc.paper.util.TraceUtil; import it.unimi.dsi.fastutil.longs.LongIterator; import java.awt.image.BufferedImage; import java.io.BufferedWriter; -@@ -855,6 +856,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant