diff options
author | Jake Potrebic <[email protected]> | 2022-05-26 12:12:14 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-26 12:12:14 -0700 |
commit | b6a6544ad128a5ed5579342ea673edf48b51c46f (patch) | |
tree | 6e1c1c4b5c9c12c37a6f85861c9b83079d6ec5c3 | |
parent | 182a609b85b8a711b04cae45ea03bad19367ea21 (diff) | |
download | Paper-b6a6544ad128a5ed5579342ea673edf48b51c46f.tar.gz Paper-b6a6544ad128a5ed5579342ea673edf48b51c46f.zip |
Provide ComponentSerializer services (#7527)
21 files changed, 502 insertions, 308 deletions
diff --git a/patches/api/0005-Adventure.patch b/patches/api/0005-Adventure.patch index 410ea2db62..1542987ee7 100644 --- a/patches/api/0005-Adventure.patch +++ b/patches/api/0005-Adventure.patch @@ -358,10 +358,10 @@ index 0000000000000000000000000000000000000000..eb179aae1e1d2ce842442e49fe275827 +} diff --git a/src/main/java/io/papermc/paper/text/PaperComponents.java b/src/main/java/io/papermc/paper/text/PaperComponents.java new file mode 100644 -index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a1d2c5641 +index 0000000000000000000000000000000000000000..bff9a6295db367c6b89d69fb55459a40828265ea --- /dev/null +++ b/src/main/java/io/papermc/paper/text/PaperComponents.java -@@ -0,0 +1,104 @@ +@@ -0,0 +1,112 @@ +package io.papermc.paper.text; + +import net.kyori.adventure.text.Component; @@ -398,10 +398,10 @@ index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a + * <p>Implementations may provide a serializer capable of processing any + * information that requires access to implementation details.</p> + * -+ * @deprecated will be removed in adventure 5.0.0, use {@link #plainTextSerializer()} + * @return a serializer to plain text ++ * @deprecated will be removed in adventure 5.0.0, use {@link PlainTextComponentSerializer#plainText()} + */ -+ @Deprecated ++ @Deprecated(forRemoval = true) + public static @NotNull PlainComponentSerializer plainSerializer() { + return Bukkit.getUnsafe().plainComponentSerializer(); + } @@ -414,7 +414,9 @@ index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a + * information that requires access to implementation details.</p> + * + * @return a serializer to plain text ++ * @deprecated use {@link PlainTextComponentSerializer#plainText()} + */ ++ @Deprecated(forRemoval = true) + public static @NotNull PlainTextComponentSerializer plainTextSerializer() { + return Bukkit.getUnsafe().plainTextSerializer(); + } @@ -428,7 +430,9 @@ index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a + * (pre-1.16) hover events.</p> + * + * @return a json component serializer ++ * @deprecated use {@link GsonComponentSerializer#gson()} + */ ++ @Deprecated(forRemoval = true) + public static @NotNull GsonComponentSerializer gsonSerializer() { + return Bukkit.getUnsafe().gsonComponentSerializer(); + } @@ -443,7 +447,9 @@ index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a + * (pre-1.16) hover events.</p> + * + * @return a json component serializer ++ * @deprecated use {@link GsonComponentSerializer#colorDownsamplingGson()} + */ ++ @Deprecated(forRemoval = true) + public static @NotNull GsonComponentSerializer colorDownsamplingGsonSerializer() { + return Bukkit.getUnsafe().colorDownsamplingGsonComponentSerializer(); + } @@ -461,7 +467,9 @@ index 0000000000000000000000000000000000000000..15ecb12fd2fefcac96edbaef7cdd487a + * information that requires access to implementation details.</p> + * + * @return a section serializer ++ * @deprecated use {@link LegacyComponentSerializer#legacySection()} + */ ++ @Deprecated(forRemoval = true) + public static @NotNull LegacyComponentSerializer legacySectionSerializer() { + return Bukkit.getUnsafe().legacyComponentSerializer(); + } @@ -1100,7 +1108,7 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68 + // Paper end } diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 01e11f882abb6c631f810584aa23646042688435..f43ad19a44f3b7368a1a110cc55247277f4d3751 100644 +index 01e11f882abb6c631f810584aa23646042688435..fa28b5bb0efd9d400277cd8969f38e039e6ea8ac 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -22,6 +22,14 @@ import org.bukkit.plugin.PluginDescriptionFile; @@ -1109,11 +1117,11 @@ index 01e11f882abb6c631f810584aa23646042688435..f43ad19a44f3b7368a1a110cc5524727 public interface UnsafeValues { + // Paper start + net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener(); -+ @Deprecated net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer(); -+ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer(); -+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer(); -+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer(); -+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); ++ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer(); ++ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer(); ++ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer(); ++ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer(); ++ @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); + // Paper end Material toLegacy(Material material); @@ -1276,7 +1284,7 @@ index ab6b0ec328e94bf65a0dafd0403e5ee3b870296c..c8d37184d8e882a4084a1bfef85faa33 /** diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 4bfc214685164a38ba4261b2bae7faa8a3bd297e..50e6d45ec9349b56d20e2ffc664eca15ba936cc6 100644 +index 4bfc214685164a38ba4261b2bae7faa8a3bd297e..8edd78adb042013bf702027f59455045d3b3e14f 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java @@ -32,8 +32,7 @@ public abstract class Command { @@ -1314,7 +1322,7 @@ index 4bfc214685164a38ba4261b2bae7faa8a3bd297e..50e6d45ec9349b56d20e2ffc664eca15 + @Deprecated // Paper public String getPermissionMessage() { - return permissionMessage; -+ return io.papermc.paper.text.PaperComponents.legacySectionSerializer().serializeOrNull(permissionMessage); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serializeOrNull(permissionMessage); // Paper } /** @@ -1328,7 +1336,7 @@ index 4bfc214685164a38ba4261b2bae7faa8a3bd297e..50e6d45ec9349b56d20e2ffc664eca15 + @Deprecated // Paper public Command setPermissionMessage(@Nullable String permissionMessage) { - this.permissionMessage = permissionMessage; -+ this.permissionMessage = io.papermc.paper.text.PaperComponents.legacySectionSerializer().deserializeOrNull(permissionMessage); // Paper ++ this.permissionMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserializeOrNull(permissionMessage); // Paper return this; } @@ -1359,7 +1367,7 @@ index 4bfc214685164a38ba4261b2bae7faa8a3bd297e..50e6d45ec9349b56d20e2ffc664eca15 public static void broadcastCommandMessage(@NotNull CommandSender source, @NotNull String message) { broadcastCommandMessage(source, message, true); diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java -index 284be63a125624a8ae43d2c164aede810ce6bfe5..f98d46fa45bb7c842d791b09f082a0968ae537fb 100644 +index 284be63a125624a8ae43d2c164aede810ce6bfe5..22b654efdcc49d6dc6d52c9d6afa1c9dc7978e35 100644 --- a/src/main/java/org/bukkit/command/CommandSender.java +++ b/src/main/java/org/bukkit/command/CommandSender.java @@ -6,12 +6,13 @@ import org.bukkit.permissions.Permissible; @@ -1456,12 +1464,12 @@ index 284be63a125624a8ae43d2c164aede810ce6bfe5..f98d46fa45bb7c842d791b09f082a096 + + @Override + default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { -+ this.sendMessage(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(message)); ++ this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); + } + // Paper end } diff --git a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java b/src/main/java/org/bukkit/command/PluginCommandYamlParser.java -index a542c4bb3c973bbe4b976642feccde6a4d90cb7b..614cba22c0997dbb45576f800675db4053a9831c 100644 +index a542c4bb3c973bbe4b976642feccde6a4d90cb7b..ef870b864c1e36032b54b31f3f85707edc06d764 100644 --- a/src/main/java/org/bukkit/command/PluginCommandYamlParser.java +++ b/src/main/java/org/bukkit/command/PluginCommandYamlParser.java @@ -67,7 +67,7 @@ public class PluginCommandYamlParser { @@ -1469,7 +1477,7 @@ index a542c4bb3c973bbe4b976642feccde6a4d90cb7b..614cba22c0997dbb45576f800675db40 if (permissionMessage != null) { - newCmd.setPermissionMessage(permissionMessage.toString()); -+ newCmd.permissionMessage(io.papermc.paper.text.PaperComponents.legacySectionSerializer().deserialize(permissionMessage.toString())); // Paper ++ newCmd.permissionMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(permissionMessage.toString())); // Paper } pluginCmds.add(newCmd); @@ -2133,7 +2141,7 @@ index 63c80b4ee1f7adc8a9efc3b607993104b1991f90..91cab8b13d5bba34007f124838b32a1d } diff --git a/src/main/java/org/bukkit/event/block/SignChangeEvent.java b/src/main/java/org/bukkit/event/block/SignChangeEvent.java -index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1f79f704abf339150df08900b8ea7da4cefef258 100644 +index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1268066e30ddb0cd3792ea4b3de894eb04196669 100644 --- a/src/main/java/org/bukkit/event/block/SignChangeEvent.java +++ b/src/main/java/org/bukkit/event/block/SignChangeEvent.java @@ -16,12 +16,25 @@ public class SignChangeEvent extends BlockEvent implements Cancellable { @@ -2158,7 +2166,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1f79f704abf339150df08900b8ea7da4 + // Paper start + this.adventure$lines = new java.util.ArrayList<>(); + for (String theLine : theLines) { -+ this.adventure$lines.add(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(theLine)); ++ this.adventure$lines.add(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(theLine)); + } + // Paper end } @@ -2214,7 +2222,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1f79f704abf339150df08900b8ea7da4 + @Deprecated // Paper public String[] getLines() { - return lines; -+ return adventure$lines.stream().map(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer()::serialize).toArray(String[]::new); // Paper ++ return adventure$lines.stream().map(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()::serialize).toArray(String[]::new); // Paper } /** @@ -2228,7 +2236,7 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1f79f704abf339150df08900b8ea7da4 + @Deprecated // Paper public String getLine(int index) throws IndexOutOfBoundsException { - return lines[index]; -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.adventure$lines.get(index)); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.adventure$lines.get(index)); // Paper } /** @@ -2241,12 +2249,12 @@ index 7190db11eff7d48df8a99f405a9dbaefdfa76e3d..1f79f704abf339150df08900b8ea7da4 + @Deprecated // Paper public void setLine(int index, @Nullable String line) throws IndexOutOfBoundsException { - lines[index] = line; -+ adventure$lines.set(index, line != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(line) : null); // Paper ++ adventure$lines.set(index, line != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(line) : null); // Paper } @Override diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..a01d4c21bedc7f1a54f5a330bb4c2909ce3a18e4 100644 +index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..7941c60b0e1840785ba2b250071591bd75bc6e35 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -12,25 +12,48 @@ import org.jetbrains.annotations.Nullable; @@ -2294,7 +2302,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..a01d4c21bedc7f1a54f5a330bb4c2909 this.newTotalExp = newTotalExp; this.newLevel = newLevel; this.deathMessage = deathMessage; -+ this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper ++ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper } @NotNull @@ -2332,7 +2340,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..a01d4c21bedc7f1a54f5a330bb4c2909 + @Deprecated // Paper public void setDeathMessage(@Nullable String deathMessage) { this.deathMessage = deathMessage; -+ this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper ++ this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper } /** @@ -2350,7 +2358,7 @@ index 3c2ea8fec3a748cab7f5ad9100d12bd8213ec6c9..a01d4c21bedc7f1a54f5a330bb4c2909 - + // Paper start //TODO: add translation API to drop String deathMessage in favor of just Adventure + private static String getDeathMessageString(net.kyori.adventure.text.Component component) { -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(component); ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(component); + } + // Paper end /** @@ -2412,7 +2420,7 @@ index 9c68c3f2d61500479f48b80264f625aaae2f3204..399afcd19fcb6acd24857ed6ab48cf0d private static final HandlerList handlers = new HandlerList(); private boolean cancel = false; diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java -index 9866c07c999f46cb585709804aaad710c3031d5a..31f6f781a0403bf6388d668f0effaed5aae94468 100644 +index 9866c07c999f46cb585709804aaad710c3031d5a..c7c45e2de8cca1bf8b8e12752e08db62403efa6a 100644 --- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java @@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull; @@ -2495,7 +2503,7 @@ index 9866c07c999f46cb585709804aaad710c3031d5a..31f6f781a0403bf6388d668f0effaed5 + @NotNull + @Deprecated // Paper + public String getKickMessage() { -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper + } + + /** @@ -2506,7 +2514,7 @@ index 9866c07c999f46cb585709804aaad710c3031d5a..31f6f781a0403bf6388d668f0effaed5 + */ + @Deprecated // Paper + public void setKickMessage(@NotNull final String message) { -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + } + /** @@ -2529,7 +2537,7 @@ index 9866c07c999f46cb585709804aaad710c3031d5a..31f6f781a0403bf6388d668f0effaed5 public void disallow(@NotNull final Result result, @NotNull final String message) { this.result = result; - this.message = message; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper } /** @@ -2538,7 +2546,7 @@ index 9866c07c999f46cb585709804aaad710c3031d5a..31f6f781a0403bf6388d668f0effaed5 public void disallow(@NotNull final PlayerPreLoginEvent.Result result, @NotNull final String message) { this.result = result == null ? null : Result.valueOf(result.name()); - this.message = message; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper } /** @@ -2568,7 +2576,7 @@ index 793b661b6d2d05de3d7f4fc26a4c018a2af58e62..f6d3b817de3001f04ea4554c7c39a129 player = who; diff --git a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java -index d06684aba7688ce06777dbd837a46856a9d7767f..851a189d42e271679abc78f95049d8badf7a2b64 100644 +index d06684aba7688ce06777dbd837a46856a9d7767f..4af1d064fcb57773dfa8f6ad40d6482973f8e1a8 100644 --- a/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerJoinEvent.java @@ -10,30 +10,60 @@ import org.jetbrains.annotations.Nullable; @@ -2586,7 +2594,7 @@ index d06684aba7688ce06777dbd837a46856a9d7767f..851a189d42e271679abc78f95049d8ba + @Deprecated // Paper end public PlayerJoinEvent(@NotNull final Player playerJoined, @Nullable final String joinMessage) { super(playerJoined); -+ this.joinMessage = joinMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(joinMessage) : null; // Paper end ++ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper end + } + + // Paper start @@ -2619,7 +2627,7 @@ index d06684aba7688ce06777dbd837a46856a9d7767f..851a189d42e271679abc78f95049d8ba + @Deprecated // Paper public String getJoinMessage() { - return joinMessage; -+ return this.joinMessage == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.joinMessage); // Paper ++ return this.joinMessage == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.joinMessage); // Paper } /** @@ -2631,12 +2639,12 @@ index d06684aba7688ce06777dbd837a46856a9d7767f..851a189d42e271679abc78f95049d8ba + @Deprecated // Paper public void setJoinMessage(@Nullable String joinMessage) { - this.joinMessage = joinMessage; -+ this.joinMessage = joinMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(joinMessage) : null; // Paper ++ this.joinMessage = joinMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(joinMessage) : null; // Paper } @NotNull diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682ff70d1a92 100644 +index 14c337f15fc804f52e52cb0a185aad38d89303a8..2b3f57d1a1c79923a2173f52d9cf61da1f75b7fc 100644 --- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java @@ -10,35 +10,84 @@ import org.jetbrains.annotations.NotNull; @@ -2652,8 +2660,8 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682f + @Deprecated // Paper public PlayerKickEvent(@NotNull final Player playerKicked, @NotNull final String kickReason, @NotNull final String leaveMessage) { + super(playerKicked); -+ this.kickReason = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper -+ this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(leaveMessage); // Paper ++ this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper ++ this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper + this.cancel = false; + } + // Paper start @@ -2711,7 +2719,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682f + @Deprecated // Paper public String getReason() { - return kickReason; -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.kickReason); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.kickReason); // Paper } /** @@ -2724,7 +2732,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682f + @Deprecated // Paper public String getLeaveMessage() { - return leaveMessage; -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.leaveMessage); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.leaveMessage); // Paper } @Override @@ -2737,7 +2745,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682f + @Deprecated // Paper public void setReason(@NotNull String kickReason) { - this.kickReason = kickReason; -+ this.kickReason = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper ++ this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper } /** @@ -2749,7 +2757,7 @@ index 14c337f15fc804f52e52cb0a185aad38d89303a8..5c0efe74237dbe6803ce023fde99682f + @Deprecated // Paper public void setLeaveMessage(@NotNull String leaveMessage) { - this.leaveMessage = leaveMessage; -+ this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(leaveMessage); // Paper ++ this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper } @NotNull @@ -2790,7 +2798,7 @@ index 36b436e145a7215682b692a87ab894df25752c1d..ebd499c1a2d11ea068e8c374edbc3967 return locale; } diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java -index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002d4cfa7e0 100644 +index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..95c53d934f928d25f7b20cfbf2e5faa3df31ddc4 100644 --- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java @@ -17,7 +17,7 @@ public class PlayerLoginEvent extends PlayerEvent { @@ -2812,7 +2820,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002 public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot this(player, hostname, address, realAddress); // Spigot this.result = result; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + } + + // Paper start @@ -2865,7 +2873,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002 + @Deprecated // Paper public String getKickMessage() { - return message; -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper } /** @@ -2877,7 +2885,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002 + @Deprecated // Paper public void setKickMessage(@NotNull final String message) { - this.message = message; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper } /** @@ -2899,7 +2907,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002 + @Deprecated // Paper start public void disallow(@NotNull final Result result, @NotNull final String message) { + this.result = result; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); + } + /** + * Disallows the player from logging in, with the given reason @@ -2913,7 +2921,7 @@ index 084ca8cfcb7381bfa4fa6280748cf9b81210a9c1..75cc54739ef841cd90568d74927d6002 this.message = message; } diff --git a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java -index fb066251f793ec3b41bfc075b9478901b15ee549..123979ed64939d615b061f91c19c630e1e1db8c7 100644 +index fb066251f793ec3b41bfc075b9478901b15ee549..6800132c6288b4588fd02b08d26f016c38f27129 100644 --- a/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerPreLoginEvent.java @@ -19,7 +19,7 @@ import org.jetbrains.annotations.NotNull; @@ -2981,7 +2989,7 @@ index fb066251f793ec3b41bfc075b9478901b15ee549..123979ed64939d615b061f91c19c630e + @Deprecated // Paper + @NotNull + public String getKickMessage() { -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper + } + + /** @@ -2992,7 +3000,7 @@ index fb066251f793ec3b41bfc075b9478901b15ee549..123979ed64939d615b061f91c19c630e + */ + @Deprecated // Paper + public void setKickMessage(@NotNull final String message) { -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper + } + /** @@ -3015,12 +3023,12 @@ index fb066251f793ec3b41bfc075b9478901b15ee549..123979ed64939d615b061f91c19c630e public void disallow(@NotNull final Result result, @NotNull final String message) { this.result = result; - this.message = message; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper } /** diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -index d70c25f404e994766a9ebce89a917c8d0719777c..849e8f10dd77e9fb46aab17752b8f1ff79e9d42e 100644 +index d70c25f404e994766a9ebce89a917c8d0719777c..0395ca85a466f6356259078d3bad48b2ce6e57b7 100644 --- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java @@ -10,30 +10,59 @@ import org.jetbrains.annotations.Nullable; @@ -3033,7 +3041,7 @@ index d70c25f404e994766a9ebce89a917c8d0719777c..849e8f10dd77e9fb46aab17752b8f1ff + @Deprecated // Paper public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage) { super(who); -+ this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper ++ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper + } + // Paper start + public PlayerQuitEvent(@NotNull final Player who, @Nullable final net.kyori.adventure.text.Component quitMessage) { @@ -3070,7 +3078,7 @@ index d70c25f404e994766a9ebce89a917c8d0719777c..849e8f10dd77e9fb46aab17752b8f1ff + @Deprecated // Paper public String getQuitMessage() { - return quitMessage; -+ return this.quitMessage == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.quitMessage); // Paper ++ return this.quitMessage == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.quitMessage); // Paper } /** @@ -3082,12 +3090,12 @@ index d70c25f404e994766a9ebce89a917c8d0719777c..849e8f10dd77e9fb46aab17752b8f1ff + @Deprecated // Paper public void setQuitMessage(@Nullable String quitMessage) { - this.quitMessage = quitMessage; -+ this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper ++ this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper } @NotNull diff --git a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java -index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..4f8c85222c7bd33217c7db0ff5f47bf397f8f3e5 100644 +index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..943d324435350d3f16fad3e21cb472a01a3ff60b 100644 --- a/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java +++ b/src/main/java/org/bukkit/event/server/BroadcastMessageEvent.java @@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull; @@ -3107,7 +3115,7 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..4f8c85222c7bd33217c7db0ff5f47bf3 public BroadcastMessageEvent(boolean isAsync, @NotNull String message, @NotNull Set<CommandSender> recipients) { + // Paper start + super(isAsync); -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); + this.recipients = recipients; + } + @@ -3152,7 +3160,7 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..4f8c85222c7bd33217c7db0ff5f47bf3 + @Deprecated // Paper public String getMessage() { - return message; -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.message); // Paper } /** @@ -3164,12 +3172,12 @@ index 03bfca9d368bbe4b7c1353d52c883e756bf69bda..4f8c85222c7bd33217c7db0ff5f47bf3 + @Deprecated // Paper public void setMessage(@NotNull String message) { - this.message = message; -+ this.message = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message); // Paper ++ this.message = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message); // Paper } /** diff --git a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java -index cc5e2fef75736e56420df4cf4f83152fa97926df..fd4db14bef92b893ddaf5424e14ee71da22dcf84 100644 +index cc5e2fef75736e56420df4cf4f83152fa97926df..172697ac5dc0ea3551a61b5589416ac68f372cd1 100644 --- a/src/main/java/org/bukkit/event/server/ServerListPingEvent.java +++ b/src/main/java/org/bukkit/event/server/ServerListPingEvent.java @@ -21,15 +21,16 @@ public class ServerListPingEvent extends ServerEvent implements Iterable<Player> @@ -3187,7 +3195,7 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..fd4db14bef92b893ddaf5424e14ee71d Validate.isTrue(numPlayers >= 0, "Cannot have negative number of players online", numPlayers); this.address = address; - this.motd = motd; -+ this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper ++ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper this.numPlayers = numPlayers; this.maxPlayers = maxPlayers; } @@ -3202,7 +3210,7 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..fd4db14bef92b893ddaf5424e14ee71d + super(true); + this.numPlayers = MAGIC_PLAYER_COUNT; + this.address = address; -+ this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper ++ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper + this.maxPlayers = maxPlayers; + } + // Paper start @@ -3260,7 +3268,7 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..fd4db14bef92b893ddaf5424e14ee71d + @Deprecated // Paper public String getMotd() { - return motd; -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.motd); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.motd); // Paper } /** @@ -3272,12 +3280,12 @@ index cc5e2fef75736e56420df4cf4f83152fa97926df..fd4db14bef92b893ddaf5424e14ee71d + @Deprecated // Paper public void setMotd(@NotNull String motd) { - this.motd = motd; -+ this.motd = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(motd); // Paper ++ this.motd = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(motd); // Paper } /** diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java -index 14346d83bc99581b18e53d19af03708c0bf22cf7..664de64b020cf9090a2fbee0afe2bfaf150adc3c 100644 +index 14346d83bc99581b18e53d19af03708c0bf22cf7..a4e3d526db2d17dc923cbe82e53d3c902d61e1f3 100644 --- a/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java @@ -446,11 +446,25 @@ public abstract class InventoryView { @@ -3292,7 +3300,7 @@ index 14346d83bc99581b18e53d19af03708c0bf22cf7..664de64b020cf9090a2fbee0afe2bfaf */ @NotNull + public /*abstract*/ net.kyori.adventure.text.Component title() { -+ return org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(this.getTitle()); ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.getTitle()); + } + // Paper end + @@ -3720,7 +3728,7 @@ index 91eee1470f0969e9eef0753c0c700ae5354f1acc..69f68ca2d62c2cfe07a193776054c14c /** diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java -index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ed0bc2024a0bb85837e25f75ae89d1fe257b2e60 100644 +index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ca763b231749f108b6773040a5c6109378b21b31 100644 --- a/src/main/java/org/bukkit/map/MapCursor.java +++ b/src/main/java/org/bukkit/map/MapCursor.java @@ -10,7 +10,7 @@ public final class MapCursor { @@ -3764,7 +3772,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ed0bc2024a0bb85837e25f75ae89d1fe setRawType(type); this.visible = visible; - this.caption = caption; -+ this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper ++ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper } + // Paper start + /** @@ -3808,7 +3816,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ed0bc2024a0bb85837e25f75ae89d1fe setType(type); this.visible = visible; - this.caption = caption; -+ this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper ++ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper } /** @@ -3844,7 +3852,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ed0bc2024a0bb85837e25f75ae89d1fe + @Deprecated // Paper public String getCaption() { - return caption; -+ return this.caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.caption); // Paper ++ return this.caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.caption); // Paper } /** @@ -3856,7 +3864,7 @@ index 83354b2a38b6261b172b91c1008dcf3313cc4a8f..ed0bc2024a0bb85837e25f75ae89d1fe + @Deprecated // Paper public void setCaption(@Nullable String caption) { - this.caption = caption; -+ this.caption = caption == null ? null : org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(caption); // Paper ++ this.caption = caption == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(caption); // Paper } /** diff --git a/patches/api/0007-Timings-v2.patch b/patches/api/0007-Timings-v2.patch index 0b5f71ee6c..d541e6cd35 100644 --- a/patches/api/0007-Timings-v2.patch +++ b/patches/api/0007-Timings-v2.patch @@ -2835,11 +2835,11 @@ index 14b078e8fa4347dd0e186e5847693904e4ceb9df..bbb4eb3c4e46ade7dd939c2b0e443616 * Sends the component to the player * diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index f43ad19a44f3b7368a1a110cc55247277f4d3751..ce5794d684a1126ec9acbf4af17f5d6fa783f551 100644 +index fa28b5bb0efd9d400277cd8969f38e039e6ea8ac..c9ecd5b1908e05a1b39dadcded27241672adcddf 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -31,6 +31,7 @@ public interface UnsafeValues { - net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); + @Deprecated(forRemoval = true) net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer(); // Paper end + void reportTimings(); // Paper @@ -2887,7 +2887,7 @@ index 0000000000000000000000000000000000000000..f9a00aecca5ec41b460bf41dfe1c6969 + } +} diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 50e6d45ec9349b56d20e2ffc664eca15ba936cc6..c4dcafac892169a7bfcc065701fffb43c6cfdf44 100644 +index 8edd78adb042013bf702027f59455045d3b3e14f..53f9262f7c61985eeef1f418098bd764522d3c9a 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java @@ -33,6 +33,8 @@ public abstract class Command { diff --git a/patches/api/0021-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch b/patches/api/0021-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch index abb4bce8e4..96483d15e1 100644 --- a/patches/api/0021-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch +++ b/patches/api/0021-Add-BaseComponent-sendMessage-methods-to-CommandSend.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BaseComponent sendMessage methods to CommandSender diff --git a/src/main/java/org/bukkit/command/CommandSender.java b/src/main/java/org/bukkit/command/CommandSender.java -index f98d46fa45bb7c842d791b09f082a0968ae537fb..e330a0d2be7a73ff84ec18499de6aecbceb5166c 100644 +index 22b654efdcc49d6dc6d52c9d6afa1c9dc7978e35..daab4d13556150d4a4875f0273795e2c4cb82d63 100644 --- a/src/main/java/org/bukkit/command/CommandSender.java +++ b/src/main/java/org/bukkit/command/CommandSender.java @@ -1,6 +1,9 @@ @@ -20,7 +20,7 @@ index f98d46fa45bb7c842d791b09f082a0968ae537fb..e330a0d2be7a73ff84ec18499de6aecb import org.jetbrains.annotations.NotNull; @@ -124,5 +127,33 @@ public interface CommandSender extends net.kyori.adventure.audience.Audience, Pe default void sendMessage(final @NotNull net.kyori.adventure.identity.Identity identity, final @NotNull net.kyori.adventure.text.Component message, final @NotNull net.kyori.adventure.audience.MessageType type) { - this.sendMessage(org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().serialize(message)); + this.sendMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); } + + /** diff --git a/patches/api/0036-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/api/0036-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index eb1703e485..1c8ac8b08e 100644 --- a/patches/api/0036-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/patches/api/0036-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..a077962fa786a3291849abfa823c7f0ec4664fce +index 0000000000000000000000000000000000000000..a79aa4834e700f845a625e9ab15760690726e81c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerHandshakeEvent.java @@ -0,0 +1,277 @@ @@ -15,16 +15,16 @@ index 0000000000000000000000000000000000000000..a077962fa786a3291849abfa823c7f0e + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.apache.commons.lang.Validate; -+import org.bukkit.Bukkit; +import org.bukkit.event.Cancellable; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; -+ -+import java.util.UUID; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + ++import java.util.UUID; ++ +/** + * This event is fired during a player handshake. + * @@ -262,7 +262,7 @@ index 0000000000000000000000000000000000000000..a077962fa786a3291849abfa823c7f0e + @NotNull + @Deprecated + public String getFailMessage() { -+ return Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.failMessage()); ++ return LegacyComponentSerializer.legacySection().serialize(this.failMessage()); + } + + /** @@ -274,7 +274,7 @@ index 0000000000000000000000000000000000000000..a077962fa786a3291849abfa823c7f0e + @Deprecated + public void setFailMessage(@NotNull String failMessage) { + Validate.notEmpty(failMessage, "fail message cannot be null or empty"); -+ this.failMessage(Bukkit.getUnsafe().legacyComponentSerializer().deserialize(failMessage)); ++ this.failMessage(LegacyComponentSerializer.legacySection().deserialize(failMessage)); + } + + @NotNull diff --git a/patches/api/0057-Add-UnknownCommandEvent.patch b/patches/api/0057-Add-UnknownCommandEvent.patch index 9e3d997b0d..64312ce49a 100644 --- a/patches/api/0057-Add-UnknownCommandEvent.patch +++ b/patches/api/0057-Add-UnknownCommandEvent.patch @@ -6,18 +6,17 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..d5632d352590dec6982a372b285a8d4a332fa589 +index 0000000000000000000000000000000000000000..57128c780bc73e39d2733cceeb21dc06c2422c3c --- /dev/null +++ b/src/main/java/org/bukkit/event/command/UnknownCommandEvent.java -@@ -0,0 +1,114 @@ +@@ -0,0 +1,113 @@ +package org.bukkit.event.command; + +import net.kyori.adventure.text.Component; -+import org.bukkit.Bukkit; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.bukkit.command.CommandSender; -+import org.bukkit.event.HandlerList; +import org.bukkit.event.Event; -+ ++import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + @@ -32,7 +31,7 @@ index 0000000000000000000000000000000000000000..d5632d352590dec6982a372b285a8d4a + + @Deprecated + public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final String message) { -+ this(sender, commandLine, message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message)); ++ this(sender, commandLine, message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message)); + } + + public UnknownCommandEvent(@NotNull final CommandSender sender, @NotNull final String commandLine, @Nullable final Component message) { @@ -74,7 +73,7 @@ index 0000000000000000000000000000000000000000..d5632d352590dec6982a372b285a8d4a + @Nullable + @Deprecated + public String getMessage() { -+ return this.message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().serialize(this.message); ++ return this.message == null ? null : LegacyComponentSerializer.legacySection().serialize(this.message); + } + + /** @@ -87,7 +86,7 @@ index 0000000000000000000000000000000000000000..d5632d352590dec6982a372b285a8d4a + */ + @Deprecated + public void setMessage(@Nullable String message) { -+ this.message(message == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(message)); ++ this.message(message == null ? null : LegacyComponentSerializer.legacySection().deserialize(message)); + } + + /** diff --git a/patches/api/0068-ProfileWhitelistVerifyEvent.patch b/patches/api/0068-ProfileWhitelistVerifyEvent.patch index ff996377f4..9bf74b4d3e 100644 --- a/patches/api/0068-ProfileWhitelistVerifyEvent.patch +++ b/patches/api/0068-ProfileWhitelistVerifyEvent.patch @@ -9,7 +9,7 @@ Allows you to do dynamic whitelisting and change of kick message diff --git a/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..8a259ab49ea79673b6da9e4e2aaecec67469994e +index 0000000000000000000000000000000000000000..c6f5e2b5459368ad1e4db9929ca14568a25793fa --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/event/profile/ProfileWhitelistVerifyEvent.java @@ -0,0 +1,142 @@ @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..8a259ab49ea79673b6da9e4e2aaecec6 + +import com.destroystokyo.paper.profile.PlayerProfile; +import net.kyori.adventure.text.Component; -+import org.bukkit.Bukkit; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.jetbrains.annotations.NotNull; @@ -62,7 +62,7 @@ index 0000000000000000000000000000000000000000..8a259ab49ea79673b6da9e4e2aaecec6 + + @Deprecated + public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable String kickMessage) { -+ this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickMessage)); ++ this(profile, whitelistEnabled, whitelisted, isOp, kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage)); + } + + public ProfileWhitelistVerifyEvent(@NotNull final PlayerProfile profile, boolean whitelistEnabled, boolean whitelisted, boolean isOp, @Nullable Component kickMessage) { @@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..8a259ab49ea79673b6da9e4e2aaecec6 + @Deprecated + @Nullable + public String getKickMessage() { -+ return this.kickMessage == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().serialize(kickMessage); ++ return this.kickMessage == null ? null : LegacyComponentSerializer.legacySection().serialize(kickMessage); + } + + /** @@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..8a259ab49ea79673b6da9e4e2aaecec6 + */ + @Deprecated + public void setKickMessage(@Nullable String kickMessage) { -+ this.kickMessage(kickMessage == null ? null : Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickMessage)); ++ this.kickMessage(kickMessage == null ? null : LegacyComponentSerializer.legacySection().deserialize(kickMessage)); + } + + /** diff --git a/patches/api/0163-Make-the-default-permission-message-configurable.patch b/patches/api/0163-Make-the-default-permission-message-configurable.patch index 5fda77296b..0800740be4 100644 --- a/patches/api/0163-Make-the-default-permission-message-configurable.patch +++ b/patches/api/0163-Make-the-default-permission-message-configurable.patch @@ -43,7 +43,7 @@ index 2042f4963c53d5a903f0de1fec6a9af3a7b2bba4..b8ed8d5d48cb4f1b2f598e2c48e4423a * Creates a PlayerProfile for the specified uuid, with name as null. * diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index b1152f4dede61383232cc6713d448840612eac13..95847fcb1ac2e430ee192f4f7ac94e981151c5db 100644 +index d039f722ab9f08bc485b581832b50830c7145c2d..97dc60444746c37c44ff5c8056f4fed04a944714 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java @@ -184,10 +184,9 @@ public abstract class Command { @@ -54,7 +54,7 @@ index b1152f4dede61383232cc6713d448840612eac13..95847fcb1ac2e430ee192f4f7ac94e98 - target.sendMessage(ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is a mistake."); // Paper start - use components for permissionMessage - } else if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { -+ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : io.papermc.paper.text.PaperComponents.legacySectionSerializer().deserialize(Bukkit.getPermissionMessage()); ++ net.kyori.adventure.text.Component permissionMessage = this.permissionMessage != null ? this.permissionMessage : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(Bukkit.getPermissionMessage()); + if (!permissionMessage.equals(net.kyori.adventure.text.Component.empty())) { target.sendMessage(permissionMessage.replaceText(net.kyori.adventure.text.TextReplacementConfig.builder().matchLiteral("<permission>").replacement(permission).build())); // Paper end diff --git a/patches/api/0177-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0177-PlayerDeathEvent-getItemsToKeep.patch index 7637e58a20..871984a4fc 100644 --- a/patches/api/0177-PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/api/0177-PlayerDeathEvent-getItemsToKeep.patch @@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 48f272747b8d5ab43f79a9d474713aca79f121b7..61d12cb8f0a924abf696b6da7258f34dbb7b51b6 100644 +index a871eddf73f918c0e3d2554ef8d9cfd0f830fcaa..5f7d0d08be8bca06c9aa89659b7865a7b5a547f8 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { @@ -20,7 +20,7 @@ index 48f272747b8d5ab43f79a9d474713aca79f121b7..61d12cb8f0a924abf696b6da7258f34d this(player, drops, droppedExp, 0, deathMessage); } @@ -56,6 +55,41 @@ public class PlayerDeathEvent extends EntityDeathEvent { - this.adventure$deathMessage = deathMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper + this.adventure$deathMessage = deathMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(deathMessage) : net.kyori.adventure.text.Component.empty(); // Paper } + @Deprecated // Paper diff --git a/patches/api/0232-Add-API-for-quit-reason.patch b/patches/api/0232-Add-API-for-quit-reason.patch index 63d864224b..70e37ffc9b 100644 --- a/patches/api/0232-Add-API-for-quit-reason.patch +++ b/patches/api/0232-Add-API-for-quit-reason.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add API for quit reason diff --git a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java -index 849e8f10dd77e9fb46aab17752b8f1ff79e9d42e..b6016aa1e91863efc252eecab69ade6f54c89f27 100644 +index 0395ca85a466f6356259078d3bad48b2ce6e57b7..6e9205024ca9d3000a371bd0eb723dcd6c662bce 100644 --- a/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerQuitEvent.java @@ -11,16 +11,28 @@ import org.jetbrains.annotations.Nullable; @@ -22,7 +22,7 @@ index 849e8f10dd77e9fb46aab17752b8f1ff79e9d42e..b6016aa1e91863efc252eecab69ade6f + @Deprecated // Paper + public PlayerQuitEvent(@NotNull final Player who, @Nullable final String quitMessage, @Nullable QuitReason quitReason) { super(who); - this.quitMessage = quitMessage != null ? org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(quitMessage) : null; // Paper + this.quitMessage = quitMessage != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(quitMessage) : null; // Paper + this.reason = quitReason == null ? QuitReason.DISCONNECTED : quitReason; } // Paper start diff --git a/patches/api/0306-Add-PlayerKickEvent-causes.patch b/patches/api/0306-Add-PlayerKickEvent-causes.patch index ab17bfb214..2f7f52b532 100644 --- a/patches/api/0306-Add-PlayerKickEvent-causes.patch +++ b/patches/api/0306-Add-PlayerKickEvent-causes.patch @@ -24,7 +24,7 @@ index 8b37b895b7de99a0be6b54c2aedfc0faddb06435..826faf48f9e2f7441a0cb5434dd1b337 /** diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -index 5c0efe74237dbe6803ce023fde99682ff70d1a92..05ecfd8c133e72d198faeeded8c757c231c871cc 100644 +index 2b3f57d1a1c79923a2173f52d9cf61da1f75b7fc..45235379b7b54f1ca36dff3bf02c496cef2f3254 100644 --- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java @@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { @@ -37,8 +37,8 @@ index 5c0efe74237dbe6803ce023fde99682ff70d1a92..05ecfd8c133e72d198faeeded8c757c2 @Deprecated // Paper @@ -19,14 +20,25 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { super(playerKicked); - this.kickReason = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(kickReason); // Paper - this.leaveMessage = org.bukkit.Bukkit.getUnsafe().legacyComponentSerializer().deserialize(leaveMessage); // Paper + this.kickReason = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(kickReason); // Paper + this.leaveMessage = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(leaveMessage); // Paper + this.cause = Cause.UNKNOWN; // Paper this.cancel = false; } diff --git a/patches/server/0008-Adventure.patch b/patches/server/0008-Adventure.patch index a2809c9cfd..aefcf75486 100644 --- a/patches/server/0008-Adventure.patch +++ b/patches/server/0008-Adventure.patch @@ -26,10 +26,10 @@ index 80a3d5890aab91e6a48d5734140187851106bde3..c1eb4201ecb0541c606ef0d05b828ae9 } diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java new file mode 100644 -index 0000000000000000000000000000000000000000..85546e1ac1d1ed7f70c3c0a1bf49937f865ad091 +index 0000000000000000000000000000000000000000..1c820b01c65f69b4b158a5d2134419b52e77f5ee --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java -@@ -0,0 +1,82 @@ +@@ -0,0 +1,84 @@ +package io.papermc.paper.adventure; + +import com.google.gson.JsonElement; @@ -39,6 +39,8 @@ index 0000000000000000000000000000000000000000..85546e1ac1d1ed7f70c3c0a1bf49937f +import java.util.List; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; ++import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; ++import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; +import net.minecraft.util.FormattedCharSequence; @@ -82,7 +84,7 @@ index 0000000000000000000000000000000000000000..85546e1ac1d1ed7f70c3c0a1bf49937f + + @Override + public String getString() { -+ return PaperAdventure.PLAIN.serialize(this.adventure); ++ return PlainTextComponentSerializer.plainText().serialize(this.adventure); + } + + @Override @@ -108,16 +110,16 @@ index 0000000000000000000000000000000000000000..85546e1ac1d1ed7f70c3c0a1bf49937f + public static class Serializer implements JsonSerializer<AdventureComponent> { + @Override + public JsonElement serialize(final AdventureComponent src, final Type type, final JsonSerializationContext context) { -+ return PaperAdventure.GSON.serializer().toJsonTree(src.adventure, Component.class); ++ return GsonComponentSerializer.gson().serializer().toJsonTree(src.adventure, Component.class); + } + } +} diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java new file mode 100644 -index 0000000000000000000000000000000000000000..65b6e260464b2003d6bd172610adb5b8651df169 +index 0000000000000000000000000000000000000000..3526bc0b6ad590776124966ea907fe2467cbbf5f --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -0,0 +1,192 @@ +@@ -0,0 +1,193 @@ +package io.papermc.paper.adventure; + +import io.papermc.paper.chat.ChatRenderer; @@ -133,6 +135,7 @@ index 0000000000000000000000000000000000000000..65b6e260464b2003d6bd172610adb5b8 +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextReplacementConfig; +import net.kyori.adventure.text.event.ClickEvent; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerPlayer; +import org.bukkit.craftbukkit.entity.CraftPlayer; @@ -195,14 +198,14 @@ index 0000000000000000000000000000000000000000..65b6e260464b2003d6bd172610adb5b8 + this.processModern( + legacyRenderer(se.getFormat()), + this.viewersFromLegacy(se.getRecipients()), -+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(se.getMessage()), ++ LegacyComponentSerializer.legacySection().deserialize(se.getMessage()), + se.isCancelled() + ); + } else { + this.processModern( + legacyRenderer(ae.getFormat()), + this.viewersFromLegacy(ae.getRecipients()), -+ PaperAdventure.LEGACY_SECTION_UXRC.deserialize(ae.getMessage()), ++ LegacyComponentSerializer.legacySection().deserialize(ae.getMessage()), + ae.isCancelled() + ); + } @@ -284,7 +287,7 @@ index 0000000000000000000000000000000000000000..65b6e260464b2003d6bd172610adb5b8 + if (DEFAULT_LEGACY_FORMAT.equals(format)) { + return ChatRenderer.defaultRenderer(); + } -+ return ChatRenderer.viewerUnaware((player, displayName, message) -> PaperAdventure.LEGACY_SECTION_UXRC.deserialize(String.format(format, legacyDisplayName((CraftPlayer) player), PaperAdventure.LEGACY_SECTION_UXRC.serialize(message))).replaceText(URL_REPLACEMENT_CONFIG)); ++ return ChatRenderer.viewerUnaware((player, displayName, message) -> LegacyComponentSerializer.legacySection().deserialize(String.format(format, legacyDisplayName((CraftPlayer) player), LegacyComponentSerializer.legacySection().serialize(message))).replaceText(URL_REPLACEMENT_CONFIG)); + } + + private void queueIfAsyncOrRunImmediately(final Waitable<Void> waitable) { @@ -312,12 +315,13 @@ index 0000000000000000000000000000000000000000..65b6e260464b2003d6bd172610adb5b8 +} diff --git a/src/main/java/io/papermc/paper/adventure/DisplayNames.java b/src/main/java/io/papermc/paper/adventure/DisplayNames.java new file mode 100644 -index 0000000000000000000000000000000000000000..fb23f5b733093384fefc331cd3bef7cf16f09293 +index 0000000000000000000000000000000000000000..3957f68182e8f7a773613a687f1d9a0cfa4f066c --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/DisplayNames.java -@@ -0,0 +1,23 @@ +@@ -0,0 +1,24 @@ +package io.papermc.paper.adventure; + ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import net.minecraft.server.level.ServerPlayer; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.entity.CraftPlayer; @@ -334,9 +338,9 @@ index 0000000000000000000000000000000000000000..fb23f5b733093384fefc331cd3bef7cf + final String legacy = player.displayName; + if (legacy != null) { + // thank you for being worse than wet socks, Bukkit -+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(player.adventure$displayName) + ChatColor.getLastColors(player.displayName); ++ return LegacyComponentSerializer.legacySection().serialize(player.adventure$displayName) + ChatColor.getLastColors(player.displayName); + } -+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(player.adventure$displayName); ++ return LegacyComponentSerializer.legacySection().serialize(player.adventure$displayName); + } +} diff --git a/src/main/java/io/papermc/paper/adventure/LazyChatAudienceSet.java b/src/main/java/io/papermc/paper/adventure/LazyChatAudienceSet.java @@ -371,106 +375,12 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559 + return audiences; + } +} -diff --git a/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java b/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java -new file mode 100644 -index 0000000000000000000000000000000000000000..eeedc30a45d9637d68f04f185b3dd90dd711b9e0 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java -@@ -0,0 +1,88 @@ -+package io.papermc.paper.adventure; -+ -+import com.mojang.brigadier.exceptions.CommandSyntaxException; -+import java.io.IOException; -+import java.util.UUID; -+import net.kyori.adventure.key.Key; -+import net.kyori.adventure.nbt.api.BinaryTagHolder; -+import net.kyori.adventure.text.Component; -+import net.kyori.adventure.text.event.HoverEvent; -+import net.kyori.adventure.text.serializer.gson.LegacyHoverEventSerializer; -+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; -+import net.kyori.adventure.util.Codec; -+import net.minecraft.nbt.CompoundTag; -+import net.minecraft.nbt.Tag; -+import net.minecraft.nbt.TagParser; -+ -+final class NBTLegacyHoverEventSerializer implements LegacyHoverEventSerializer { -+ public static final NBTLegacyHoverEventSerializer INSTANCE = new NBTLegacyHoverEventSerializer(); -+ private static final Codec<CompoundTag, String, CommandSyntaxException, RuntimeException> SNBT_CODEC = Codec.of(TagParser::parseTag, Tag::toString); -+ -+ static final String ITEM_TYPE = "id"; -+ static final String ITEM_COUNT = "Count"; -+ static final String ITEM_TAG = "tag"; -+ -+ static final String ENTITY_NAME = "name"; -+ static final String ENTITY_TYPE = "type"; -+ static final String ENTITY_ID = "id"; -+ -+ NBTLegacyHoverEventSerializer() { -+ } -+ -+ @Override -+ public HoverEvent.ShowItem deserializeShowItem(final Component input) throws IOException { -+ final String raw = PlainComponentSerializer.plain().serialize(input); -+ try { -+ final CompoundTag contents = SNBT_CODEC.decode(raw); -+ final CompoundTag tag = contents.getCompound(ITEM_TAG); -+ return HoverEvent.ShowItem.of( -+ Key.key(contents.getString(ITEM_TYPE)), -+ contents.contains(ITEM_COUNT) ? contents.getByte(ITEM_COUNT) : 1, -+ tag.isEmpty() ? null : BinaryTagHolder.encode(tag, SNBT_CODEC) -+ ); -+ } catch (final CommandSyntaxException ex) { -+ throw new IOException(ex); -+ } -+ } -+ -+ @Override -+ public HoverEvent.ShowEntity deserializeShowEntity(final Component input, final Codec.Decoder<Component, String, ? extends RuntimeException> componentCodec) throws IOException { -+ final String raw = PlainComponentSerializer.plain().serialize(input); -+ try { -+ final CompoundTag contents = SNBT_CODEC.decode(raw); -+ return HoverEvent.ShowEntity.of( -+ Key.key(contents.getString(ENTITY_TYPE)), -+ UUID.fromString(contents.getString(ENTITY_ID)), -+ componentCodec.decode(contents.getString(ENTITY_NAME)) -+ ); -+ } catch (final CommandSyntaxException ex) { -+ throw new IOException(ex); -+ } -+ } -+ -+ @Override -+ public Component serializeShowItem(final HoverEvent.ShowItem input) throws IOException { -+ final CompoundTag tag = new CompoundTag(); -+ tag.putString(ITEM_TYPE, input.item().asString()); -+ tag.putByte(ITEM_COUNT, (byte) input.count()); -+ if (input.nbt() != null) { -+ try { -+ tag.put(ITEM_TAG, input.nbt().get(SNBT_CODEC)); -+ } catch (final CommandSyntaxException ex) { -+ throw new IOException(ex); -+ } -+ } -+ return Component.text(SNBT_CODEC.encode(tag)); -+ } -+ -+ @Override -+ public Component serializeShowEntity(final HoverEvent.ShowEntity input, final Codec.Encoder<Component, String, ? extends RuntimeException> componentCodec) throws IOException { -+ final CompoundTag tag = new CompoundTag(); -+ tag.putString(ENTITY_ID, input.id().toString()); -+ tag.putString(ENTITY_TYPE, input.type().asString()); -+ if (input.name() != null) { -+ tag.putString(ENTITY_NAME, componentCodec.encode(input.name())); -+ } -+ return Component.text(SNBT_CODEC.encode(tag)); -+ } -+} diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java new file mode 100644 -index 0000000000000000000000000000000000000000..85c9056f92711b985e251f0f06ed551d03deb562 +index 0000000000000000000000000000000000000000..3f25a9b1a74cfa0c9a4d0379ecda109d99f33db3 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java -@@ -0,0 +1,341 @@ +@@ -0,0 +1,331 @@ +package io.papermc.paper.adventure; + +import com.mojang.brigadier.exceptions.CommandSyntaxException; @@ -564,17 +474,7 @@ index 0000000000000000000000000000000000000000..85c9056f92711b985e251f0f06ed551d + } + }) + .build(); -+ public static final LegacyComponentSerializer LEGACY_SECTION_UXRC = LegacyComponentSerializer.builder().flattener(FLATTENER).hexColors().useUnusualXRepeatedCharacterHexFormat().build(); -+ @Deprecated -+ public static final PlainComponentSerializer PLAIN_COMPONENT = PlainComponentSerializer.builder().flattener(FLATTENER).build(); -+ public static final PlainTextComponentSerializer PLAIN = PlainTextComponentSerializer.builder().flattener(FLATTENER).build(); -+ public static final GsonComponentSerializer GSON = GsonComponentSerializer.builder() -+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE) -+ .build(); -+ public static final GsonComponentSerializer COLOR_DOWNSAMPLING_GSON = GsonComponentSerializer.builder() -+ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE) -+ .downsampleColors() -+ .build(); ++ @Deprecated public static final PlainComponentSerializer PLAIN = PlainComponentSerializer.builder().flattener(FLATTENER).build(); + private static final Codec<CompoundTag, String, IOException, IOException> NBT_CODEC = new Codec<CompoundTag, String, IOException, IOException>() { + @Override + public @NotNull CompoundTag decode(final @NotNull String encoded) throws IOException { @@ -611,7 +511,7 @@ index 0000000000000000000000000000000000000000..85c9056f92711b985e251f0f06ed551d + // Component + + public static Component asAdventure(final net.minecraft.network.chat.Component component) { -+ return component == null ? Component.empty() : GSON.serializer().fromJson(net.minecraft.network.chat.Component.Serializer.toJsonTree(component), Component.class); ++ return component == null ? Component.empty() : GsonComponentSerializer.gson().serializer().fromJson(net.minecraft.network.chat.Component.Serializer.toJsonTree(component), Component.class); + } + + public static ArrayList<Component> asAdventure(final List<net.minecraft.network.chat.Component> vanillas) { @@ -641,7 +541,7 @@ index 0000000000000000000000000000000000000000..85c9056f92711b985e251f0f06ed551d + public static net.minecraft.network.chat.Component asVanilla(final Component component) { + if (component == null) return null; + if (true) return new AdventureComponent(component); -+ return net.minecraft.network.chat.Component.Serializer.fromJson(GSON.serializer().toJsonTree(component)); ++ return net.minecraft.network.chat.Component.Serializer.fromJson(GsonComponentSerializer.gson().serializer().toJsonTree(component)); + } + + public static List<net.minecraft.network.chat.Component> asVanilla(final List<Component> adventures) { @@ -653,7 +553,7 @@ index 0000000000000000000000000000000000000000..85c9056f92711b985e251f0f06ed551d + } + + public static String asJsonString(final Component component, final Locale locale) { -+ return GSON.serialize(translated(component, locale)); ++ return GsonComponentSerializer.gson().serialize(translated(component, locale)); + } + + public static String asJsonString(final net.minecraft.network.chat.Component component, final Locale locale) { @@ -664,7 +564,7 @@ index 0000000000000000000000000000000000000000..85c9056f92711b985e251f0f06ed551d + } + + public static String asPlain(final Component component, final Locale locale) { -+ return PLAIN.serialize(translated(component, locale)); ++ return PlainTextComponentSerializer.plainText().serialize(translated(component, locale)); + } + + private static Component translated(final Component component, final Locale locale) { @@ -864,14 +764,15 @@ index 0000000000000000000000000000000000000000..7493efba31403cbe7f26e493f165f1b8 +} diff --git a/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java new file mode 100644 -index 0000000000000000000000000000000000000000..76be058996599dd798d26a166d1a5139ee72761a +index 0000000000000000000000000000000000000000..2a08e0461db4e699b7e6a1558a4419c848fc7f4f --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java -@@ -0,0 +1,19 @@ +@@ -0,0 +1,20 @@ +package io.papermc.paper.adventure; + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.ComponentSerializer; ++import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; + +final class WrapperAwareSerializer implements ComponentSerializer<Component, Component, net.minecraft.network.chat.Component> { + @Override @@ -879,12 +780,240 @@ index 0000000000000000000000000000000000000000..76be058996599dd798d26a166d1a5139 + if (input instanceof AdventureComponent) { + return ((AdventureComponent) input).adventure; + } -+ return PaperAdventure.GSON.serializer().fromJson(net.minecraft.network.chat.Component.Serializer.toJsonTree(input), Component.class); ++ return GsonComponentSerializer.gson().serializer().fromJson(net.minecraft.network.chat.Component.Serializer.toJsonTree(input), Component.class); + } + + @Override + public net.minecraft.network.chat.Component serialize(final Component component) { -+ return net.minecraft.network.chat.Component.Serializer.fromJson(PaperAdventure.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/GsonComponentSerializerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/GsonComponentSerializerProviderImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c620d5aa2b0208b769dbe9563f0e99edc9a91047 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/adventure/providers/GsonComponentSerializerProviderImpl.java +@@ -0,0 +1,30 @@ ++package io.papermc.paper.adventure.providers; ++ ++import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++@SuppressWarnings("UnstableApiUsage") // permitted provider ++public class GsonComponentSerializerProviderImpl implements GsonComponentSerializer.Provider { ++ ++ @Override ++ public @NotNull GsonComponentSerializer gson() { ++ return GsonComponentSerializer.builder() ++ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE) ++ .build(); ++ } ++ ++ @Override ++ public @NotNull GsonComponentSerializer gsonLegacy() { ++ return GsonComponentSerializer.builder() ++ .legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE) ++ .downsampleColors() ++ .build(); ++ } ++ ++ @Override ++ public @NotNull Consumer<GsonComponentSerializer.Builder> builder() { ++ return builder -> builder.legacyHoverEventSerializer(NBTLegacyHoverEventSerializer.INSTANCE); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/adventure/providers/LegacyComponentSerializerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/LegacyComponentSerializerProviderImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..03723dbe32b7eb95253e8ff6e72dbf8d2300a059 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/adventure/providers/LegacyComponentSerializerProviderImpl.java +@@ -0,0 +1,36 @@ ++package io.papermc.paper.adventure.providers; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++@SuppressWarnings("UnstableApiUsage") // permitted provider ++public class LegacyComponentSerializerProviderImpl implements LegacyComponentSerializer.Provider { ++ ++ @Override ++ public @NotNull LegacyComponentSerializer legacyAmpersand() { ++ return LegacyComponentSerializer.builder() ++ .flattener(PaperAdventure.FLATTENER) ++ .character(LegacyComponentSerializer.AMPERSAND_CHAR) ++ .hexColors() ++ .useUnusualXRepeatedCharacterHexFormat() ++ .build(); ++ } ++ ++ @Override ++ public @NotNull LegacyComponentSerializer legacySection() { ++ return LegacyComponentSerializer.builder() ++ .flattener(PaperAdventure.FLATTENER) ++ .character(LegacyComponentSerializer.SECTION_CHAR) ++ .hexColors() ++ .useUnusualXRepeatedCharacterHexFormat() ++ .build(); ++ } ++ ++ @Override ++ public @NotNull Consumer<LegacyComponentSerializer.Builder> legacy() { ++ return builder -> builder.flattener(PaperAdventure.FLATTENER); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/adventure/providers/MiniMessageProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/MiniMessageProviderImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..25fd6992c869c841b1b1b3240f4d524948487614 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/adventure/providers/MiniMessageProviderImpl.java +@@ -0,0 +1,20 @@ ++package io.papermc.paper.adventure.providers; ++ ++import net.kyori.adventure.text.minimessage.MiniMessage; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++@SuppressWarnings("UnstableApiUsage") // permitted provider ++public class MiniMessageProviderImpl implements MiniMessage.Provider { ++ ++ @Override ++ public @NotNull MiniMessage miniMessage() { ++ return MiniMessage.builder().build(); ++ } ++ ++ @Override ++ public @NotNull Consumer<MiniMessage.Builder> builder() { ++ return builder -> {}; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java b/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b3514a3e415f3444a235f1a45f0c53741264e516 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java +@@ -0,0 +1,89 @@ ++package io.papermc.paper.adventure.providers; ++ ++import com.mojang.brigadier.exceptions.CommandSyntaxException; ++import net.kyori.adventure.key.Key; ++import net.kyori.adventure.nbt.api.BinaryTagHolder; ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.event.HoverEvent; ++import net.kyori.adventure.text.serializer.gson.LegacyHoverEventSerializer; ++import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; ++import net.kyori.adventure.util.Codec; ++import net.minecraft.nbt.CompoundTag; ++import net.minecraft.nbt.Tag; ++import net.minecraft.nbt.TagParser; ++ ++import java.io.IOException; ++import java.util.UUID; ++ ++final class NBTLegacyHoverEventSerializer implements LegacyHoverEventSerializer { ++ public static final NBTLegacyHoverEventSerializer INSTANCE = new NBTLegacyHoverEventSerializer(); ++ private static final Codec<CompoundTag, String, CommandSyntaxException, RuntimeException> SNBT_CODEC = Codec.codec(TagParser::parseTag, Tag::toString); ++ ++ static final String ITEM_TYPE = "id"; ++ static final String ITEM_COUNT = "Count"; ++ static final String ITEM_TAG = "tag"; ++ ++ static final String ENTITY_NAME = "name"; ++ static final String ENTITY_TYPE = "type"; ++ static final String ENTITY_ID = "id"; ++ ++ NBTLegacyHoverEventSerializer() { ++ } ++ ++ @Override ++ public HoverEvent.ShowItem deserializeShowItem(final Component input) throws IOException { ++ final String raw = PlainTextComponentSerializer.plainText().serialize(input); ++ try { ++ final CompoundTag contents = SNBT_CODEC.decode(raw); ++ final CompoundTag tag = contents.getCompound(ITEM_TAG); ++ return HoverEvent.ShowItem.of( ++ Key.key(contents.getString(ITEM_TYPE)), ++ contents.contains(ITEM_COUNT) ? contents.getByte(ITEM_COUNT) : 1, ++ tag.isEmpty() ? null : BinaryTagHolder.encode(tag, SNBT_CODEC) ++ ); ++ } catch (final CommandSyntaxException ex) { ++ throw new IOException(ex); ++ } ++ } ++ ++ @Override ++ public HoverEvent.ShowEntity deserializeShowEntity(final Component input, final Codec.Decoder<Component, String, ? extends RuntimeException> componentCodec) throws IOException { ++ final String raw = PlainTextComponentSerializer.plainText().serialize(input); ++ try { ++ final CompoundTag contents = SNBT_CODEC.decode(raw); ++ return HoverEvent.ShowEntity.of( ++ Key.key(contents.getString(ENTITY_TYPE)), ++ UUID.fromString(contents.getString(ENTITY_ID)), ++ componentCodec.decode(contents.getString(ENTITY_NAME)) ++ ); ++ } catch (final CommandSyntaxException ex) { ++ throw new IOException(ex); ++ } ++ } ++ ++ @Override ++ public Component serializeShowItem(final HoverEvent.ShowItem input) throws IOException { ++ final CompoundTag tag = new CompoundTag(); ++ tag.putString(ITEM_TYPE, input.item().asString()); ++ tag.putByte(ITEM_COUNT, (byte) input.count()); ++ if (input.nbt() != null) { ++ try { ++ tag.put(ITEM_TAG, input.nbt().get(SNBT_CODEC)); ++ } catch (final CommandSyntaxException ex) { ++ throw new IOException(ex); ++ } ++ } ++ return Component.text(SNBT_CODEC.encode(tag)); ++ } ++ ++ @Override ++ public Component serializeShowEntity(final HoverEvent.ShowEntity input, final Codec.Encoder<Component, String, ? extends RuntimeException> componentCodec) throws IOException { ++ final CompoundTag tag = new CompoundTag(); ++ tag.putString(ENTITY_ID, input.id().toString()); ++ tag.putString(ENTITY_TYPE, input.type().asString()); ++ if (input.name() != null) { ++ tag.putString(ENTITY_NAME, componentCodec.encode(input.name())); ++ } ++ return Component.text(SNBT_CODEC.encode(tag)); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/adventure/providers/PlainTextComponentSerializerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/PlainTextComponentSerializerProviderImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..c0701d4f93a4d77a8177d2dd8d5076f9f781873d +--- /dev/null ++++ b/src/main/java/io/papermc/paper/adventure/providers/PlainTextComponentSerializerProviderImpl.java +@@ -0,0 +1,23 @@ ++package io.papermc.paper.adventure.providers; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.function.Consumer; ++ ++@SuppressWarnings("UnstableApiUsage") // permitted provider ++public class PlainTextComponentSerializerProviderImpl implements PlainTextComponentSerializer.Provider { ++ ++ @Override ++ public @NotNull PlainTextComponentSerializer plainTextSimple() { ++ return PlainTextComponentSerializer.builder() ++ .flattener(PaperAdventure.FLATTENER) ++ .build(); ++ } ++ ++ @Override ++ public @NotNull Consumer<PlainTextComponentSerializer.Builder> plainText() { ++ return builder -> builder.flattener(PaperAdventure.FLATTENER); + } +} diff --git a/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java b/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java @@ -1259,7 +1388,7 @@ index 0753fdff0fe7b660af8bc09ad98a95701b1aaa01..91c1447c9e365345e02b9162e3b9e721 - this.disconnect(CraftChatMessage.fromComponent(reason)); + public void disconnect(String s) { + // Paper start -+ this.disconnect(PaperAdventure.LEGACY_SECTION_UXRC.deserialize(s)); ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); } - // CraftBukkit end @@ -1491,7 +1620,7 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..be9a29f01d59584a1492d925248f0947 } else if (!this.isWhiteListed(gameprofile)) { chatmessage = new TranslatableComponent("multiplayer.disconnect.not_whitelisted"); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot -+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure ++ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); @@ -1505,7 +1634,7 @@ index 60b4044e3d914ff83a4f37499e278fbcbc65e5c1..be9a29f01d59584a1492d925248f0947 // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null; if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) { - event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot -+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure ++ event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure } } @@ -1657,7 +1786,7 @@ index d29c6d0536619fab5a48fbb52115dac09e7d7ca3..75871f74a25ee34db89a431de584b998 @Override + public net.kyori.adventure.text.Component shutdownMessage() { + String msg = getShutdownMessage(); -+ return msg != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(msg) : null; ++ return msg != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(msg) : null; + } + // Paper end + @Override @@ -1672,7 +1801,7 @@ index d29c6d0536619fab5a48fbb52115dac09e7d7ca3..75871f74a25ee34db89a431de584b998 + @Deprecated // Paper public int broadcast(String message, String permission) { + // Paper start - Adventure -+ return this.broadcast(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(message), permission); ++ return this.broadcast(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(message), permission); + } + + @Override @@ -1918,7 +2047,7 @@ index 0beb96dc896f63003e1b1ae458b73902bdbe648a..102eb86bad3000f258775ac06ecd1a6d public String getCustomName() { EnchantmentTableBlockEntity enchant = this.getSnapshot(); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 9e68893b189ad05e4d2a5e8788e93e10670ac824..9d513b3a1a50e67284ee7ebdc5607e4f44bd0a4b 100644 +index 9e68893b189ad05e4d2a5e8788e93e10670ac824..26f21754b5ec3d1cbd455c4d9d04af299fc10b1b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -14,34 +14,60 @@ import org.bukkit.entity.Player; @@ -1977,21 +2106,21 @@ index 9e68893b189ad05e4d2a5e8788e93e10670ac824..9d513b3a1a50e67284ee7ebdc5607e4f + @Override + public String[] getLines() { + this.loadLines(); -+ return this.lines.stream().map(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC::serialize).toArray(String[]::new); // Paper ++ return this.lines.stream().map(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()::serialize).toArray(String[]::new); // Paper + } + @Override public String getLine(int index) throws IndexOutOfBoundsException { - return this.getLines()[index]; + this.loadLines(); -+ return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.lines.get(index)); // Paper ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(this.lines.get(index)); // Paper } @Override public void setLine(int index, String line) throws IndexOutOfBoundsException { - this.getLines()[index] = line; + this.loadLines(); -+ this.lines.set(index, line != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(line) : net.kyori.adventure.text.Component.empty()); // Paper ++ this.lines.set(index, line != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(line) : net.kyori.adventure.text.Component.empty()); // Paper } @Override @@ -2056,7 +2185,7 @@ index 83efca7144b4ce9cf7bd6bbbbf9c4426d2472315..bf4c5c83c3c6d710c9c40257087a2c74 public boolean isOp() { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java -index f3cb4102ab223f379f60dac317df7da1fab812a8..269738c499c6aab6f8c39ba4ffd12fa09f0d79dc 100644 +index f3cb4102ab223f379f60dac317df7da1fab812a8..324e6d1a4fadd3e557e4ba05f04e6a5891cc54df 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java @@ -46,6 +46,13 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co @@ -2081,7 +2210,7 @@ index f3cb4102ab223f379f60dac317df7da1fab812a8..269738c499c6aab6f8c39ba4ffd12fa0 + // Paper start + @Override + public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) { -+ this.sendRawMessage(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(message)); ++ this.sendRawMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); + } + // Paper end } @@ -2233,7 +2362,7 @@ index a4907dee676e9e9cc2725a3312831198a0db7b10..4b7ed15279bbdd116d993f190094f80c @Override public boolean isPermissionSet(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index b4d3f6358b8a762d44586fbded8844ba5485f2d0..ebd5372fdd7aa3e5e67a8b3b916176eeb6ff54bf 100644 +index b4d3f6358b8a762d44586fbded8844ba5485f2d0..ea952e82078acc2256757b599d1d4ca457f951b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -317,9 +317,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -2243,7 +2372,7 @@ index b4d3f6358b8a762d44586fbded8844ba5485f2d0..ebd5372fdd7aa3e5e67a8b3b916176ee - String title = container.getBukkitView().getTitle(); + //String title = container.getBukkitView().getTitle(); // Paper - comment + net.kyori.adventure.text.Component adventure$title = container.getBukkitView().title(); // Paper -+ if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(container.getBukkitView().getTitle()); // Paper ++ if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper - player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, CraftChatMessage.fromString(title)[0])); + //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper // Paper - comment @@ -2260,7 +2389,7 @@ index b4d3f6358b8a762d44586fbded8844ba5485f2d0..ebd5372fdd7aa3e5e67a8b3b916176ee + + //String title = inventory.getTitle(); // Paper - comment + net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper -+ if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(inventory.getTitle()); // Paper ++ if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper + //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment + player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper player.containerMenu = container; @@ -2298,7 +2427,7 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..7ff1fcfdc87bcd299da46fe8a7e090c1 @Override public void setDisplayName(final String name) { -+ this.getHandle().adventure$displayName = name != null ? io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(name) : net.kyori.adventure.text.Component.text(this.getName()); // Paper ++ this.getHandle().adventure$displayName = name != null ? net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(name) : net.kyori.adventure.text.Component.text(this.getName()); // Paper this.getHandle().displayName = name == null ? getName() : name; } @@ -2340,26 +2469,26 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..7ff1fcfdc87bcd299da46fe8a7e090c1 @Override public String getPlayerListHeader() { - return (this.playerListHeader == null) ? null : CraftChatMessage.fromComponent(playerListHeader); -+ return (this.playerListHeader == null) ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(playerListHeader); ++ return (this.playerListHeader == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(playerListHeader); } @Override public String getPlayerListFooter() { - return (this.playerListFooter == null) ? null : CraftChatMessage.fromComponent(playerListFooter); -+ return (this.playerListFooter == null) ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(playerListFooter); // Paper - Adventure ++ return (this.playerListFooter == null) ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(playerListFooter); // Paper - Adventure } @Override public void setPlayerListHeader(String header) { - this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true); -+ this.playerListHeader = header == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure ++ this.playerListHeader = header == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(header); // Paper - Adventure this.updatePlayerListHeaderFooter(); } @Override public void setPlayerListFooter(String footer) { - this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true); -+ this.playerListFooter = footer == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure ++ this.playerListFooter = footer == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(footer); // Paper - Adventure this.updatePlayerListHeaderFooter(); } @@ -2367,8 +2496,8 @@ index 2577a135bb88adc9000ab67477846c6466d973e7..7ff1fcfdc87bcd299da46fe8a7e090c1 public void setPlayerListHeaderFooter(String header, String footer) { - this.playerListHeader = CraftChatMessage.fromStringOrNull(header, true); - this.playerListFooter = CraftChatMessage.fromStringOrNull(footer, true); -+ this.playerListHeader = header == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(header); // Paper - Adventure -+ this.playerListFooter = footer == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(footer); // Paper - Adventure ++ this.playerListHeader = header == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(header); // Paper - Adventure ++ this.playerListFooter = footer == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(footer); // Paper - Adventure this.updatePlayerListHeaderFooter(); } @@ -2744,7 +2873,7 @@ index af9facfaa8bba614e37bd604ca0656a852d0325b..60fa587ce17e138d2baf8959c26e25ed public String getTitle() { return inventory instanceof CraftInventoryCustom ? ((CraftInventoryCustom.MinecraftInventory) ((CraftInventory) inventory).getInventory()).getTitle() : inventory.getType().getDefaultTitle(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -index 6486a76466691f958349a4706d7c9caff9cb8f64..08fc05836b26f5f93ae74324705d5f593b57315a 100644 +index 6486a76466691f958349a4706d7c9caff9cb8f64..f3ebaefd949ae73afad3dcb69b8d9c632cc782f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -19,6 +19,12 @@ public class CraftInventoryCustom extends CraftInventory { @@ -2795,7 +2924,7 @@ index 6486a76466691f958349a4706d7c9caff9cb8f64..08fc05836b26f5f93ae74324705d5f59 Validate.notNull(title, "Title cannot be null"); this.items = NonNullList.withSize(size, ItemStack.EMPTY); this.title = title; -+ this.adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(title); ++ this.adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(title); this.viewers = new ArrayList<HumanEntity>(); this.owner = owner; this.type = InventoryType.CHEST; @@ -2805,7 +2934,7 @@ index 6486a76466691f958349a4706d7c9caff9cb8f64..08fc05836b26f5f93ae74324705d5f59 + public MinecraftInventory(final InventoryHolder owner, final int size, final net.kyori.adventure.text.Component title) { + Validate.notNull(title, "Title cannot be null"); + this.items = NonNullList.withSize(size, ItemStack.EMPTY); -+ this.title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title); ++ this.title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title); + this.adventure$title = title; + this.viewers = new ArrayList<HumanEntity>(); + this.owner = owner; @@ -2910,7 +3039,7 @@ index 059c84a4e50b043f2ac2a033d5d3cbf3cba3b3f9..552851cff3678d605428866999951fef @Override public CraftMerchant getCraftMerchant() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index ca359cb1ac5f48d4f75d33946fcddedb270407c2..0f753f4868141ecc383877ea3a666a383f2e3339 100644 +index ca359cb1ac5f48d4f75d33946fcddedb270407c2..fefa4d83c5699be0b55794cd28d13d27b66ef108 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -1,8 +1,9 @@ @@ -2943,30 +3072,30 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..0f753f4868141ecc383877ea3a666a38 + // Paper start + @Override + public net.kyori.adventure.text.Component title() { -+ return this.title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(this.title); ++ return this.title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.title); + } + + @Override + public org.bukkit.inventory.meta.BookMeta title(net.kyori.adventure.text.Component title) { -+ this.setTitle(title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title)); ++ this.setTitle(title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title)); + return this; + } + + @Override + public net.kyori.adventure.text.Component author() { -+ return this.author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(this.author); ++ return this.author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(this.author); + } + + @Override + public org.bukkit.inventory.meta.BookMeta author(net.kyori.adventure.text.Component author) { -+ this.setAuthor(author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(author)); ++ this.setAuthor(author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(author)); + return this; + } + + @Override + public net.kyori.adventure.text.Component page(final int page) { + Validate.isTrue(isValidPage(page), "Invalid page number"); -+ return this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(pages.get(page - 1)) : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(pages.get(page - 1)); ++ return this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(pages.get(page - 1)) : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(pages.get(page - 1)); + } + + @Override @@ -2977,7 +3106,7 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..0f753f4868141ecc383877ea3a666a38 + if (data == null) { + data = net.kyori.adventure.text.Component.empty(); + } -+ pages.set(page - 1, this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(data) : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(data)); ++ pages.set(page - 1, this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(data) : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(data)); + } + + @Override @@ -2986,7 +3115,7 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..0f753f4868141ecc383877ea3a666a38 + if (this instanceof CraftMetaBookSigned) + return pages.stream().map(net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson()::deserialize).collect(ImmutableList.toImmutableList()); + else -+ return pages.stream().map(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC::deserialize).collect(ImmutableList.toImmutableList()); ++ return pages.stream().map(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()::deserialize).collect(ImmutableList.toImmutableList()); + } + + @Override @@ -3017,15 +3146,15 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..0f753f4868141ecc383877ea3a666a38 + page = net.kyori.adventure.text.Component.empty(); + } + -+ this.pages.add(this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(page) : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(page)); ++ this.pages.add(this instanceof CraftMetaBookSigned ? net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().serialize(page) : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(page)); + } + } + + private CraftMetaBook(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component author, List<net.kyori.adventure.text.Component> pages) { + super((org.bukkit.craftbukkit.inventory.CraftMetaItem) org.bukkit.Bukkit.getItemFactory().getItemMeta(org.bukkit.Material.WRITABLE_BOOK)); -+ this.title = title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title); -+ this.author = author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(author); -+ this.pages = pages.subList(0, Math.min(MAX_PAGES, pages.size())).stream().map(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC::serialize).collect(java.util.stream.Collectors.toList()); ++ this.title = title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title); ++ this.author = author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(author); ++ this.pages = pages.subList(0, Math.min(MAX_PAGES, pages.size())).stream().map(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection()::serialize).collect(java.util.stream.Collectors.toList()); + } + + static class CraftMetaBookBuilder implements BookMetaBuilder { @@ -3092,7 +3221,7 @@ index ca359cb1ac5f48d4f75d33946fcddedb270407c2..0f753f4868141ecc383877ea3a666a38 if (this.hasTitle()) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java -index 00445fc7373c70f4cecc4114f9bcfb4b6f27c0e8..b132c151e4fb6c64b633a0712100c3ae5adb81a9 100644 +index 00445fc7373c70f4cecc4114f9bcfb4b6f27c0e8..67a198fe1ba930836b82fcc22ab25eb1810be0cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java @@ -1,6 +1,6 @@ @@ -3116,8 +3245,8 @@ index 00445fc7373c70f4cecc4114f9bcfb4b6f27c0e8..b132c151e4fb6c64b633a0712100c3ae + // Paper start - adventure + private CraftMetaBookSigned(net.kyori.adventure.text.Component title, net.kyori.adventure.text.Component author, java.util.List<net.kyori.adventure.text.Component> pages) { + super((org.bukkit.craftbukkit.inventory.CraftMetaItem) org.bukkit.Bukkit.getItemFactory().getItemMeta(Material.WRITABLE_BOOK)); -+ this.title = title == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(title); -+ this.author = author == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(author); ++ this.title = title == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(title); ++ this.author = author == null ? null : net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(author); + this.pages = io.papermc.paper.adventure.PaperAdventure.asJson(pages.subList(0, Math.min(MAX_PAGES, pages.size()))); + } + @@ -3382,7 +3511,7 @@ index afc059755ae3e7b1c0a4cf3c6b8f32ce13cc458d..5f2af880619e01a03e05258ae1f9fa58 + CraftCriteria craftCriteria = CraftCriteria.getFromBukkit(criteria); + ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType)); + return new CraftObjective(this, objective);*/ // Paper -+ return registerNewObjective(name, criteria, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(displayName), renderType); // Paper ++ return registerNewObjective(name, criteria, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(displayName), renderType); // Paper } @Override @@ -3482,27 +3611,27 @@ index 6e990ab85b1510a952de931a0ae4f5b6356da13f..5e5904e24bb9e4992567190cf6b40fe8 + + @Override + public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer() { -+ return io.papermc.paper.adventure.PaperAdventure.COLOR_DOWNSAMPLING_GSON; ++ return net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.colorDownsamplingGson(); + } + + @Override + public net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer() { -+ return io.papermc.paper.adventure.PaperAdventure.GSON; ++ return net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson(); + } + + @Override + public net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer() { -+ return io.papermc.paper.adventure.PaperAdventure.PLAIN_COMPONENT; ++ return io.papermc.paper.adventure.PaperAdventure.PLAIN; + } + + @Override + public net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainTextSerializer() { -+ return io.papermc.paper.adventure.PaperAdventure.PLAIN; ++ return net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer.plainText(); + } + + @Override + public net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer() { -+ return io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC; ++ return net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection(); + } + // Paper end + @@ -3545,3 +3674,60 @@ index 838d5b877c01be3ef353f434d98e27b46c0a3fb4..5c4c0ba05f10d2d83b22d3e86805cfa8 HashSet<Player> reference = new HashSet<Player>(players.size()); for (ServerPlayer player : players) { reference.add(player.getBukkitEntity()); +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 +index 0000000000000000000000000000000000000000..6ce632b6c9dc5e4b3b978331df51c0ffd1526471 +--- /dev/null ++++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.minimessage.MiniMessage$Provider +@@ -0,0 +1 @@ ++io.papermc.paper.adventure.providers.MiniMessageProviderImpl +diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.gson.GsonComponentSerializer$Provider b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.gson.GsonComponentSerializer$Provider +new file mode 100644 +index 0000000000000000000000000000000000000000..bc9f7398a0fe158af05b562a8ded9e74a22eae9b +--- /dev/null ++++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.gson.GsonComponentSerializer$Provider +@@ -0,0 +1 @@ ++io.papermc.paper.adventure.providers.GsonComponentSerializerProviderImpl +diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer$Provider b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer$Provider +new file mode 100644 +index 0000000000000000000000000000000000000000..820f381981a91754b7f0c5106f93b773d885e321 +--- /dev/null ++++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer$Provider +@@ -0,0 +1 @@ ++io.papermc.paper.adventure.providers.LegacyComponentSerializerProviderImpl +diff --git a/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider +new file mode 100644 +index 0000000000000000000000000000000000000000..28d777610b52ba74f808bf3245d73b8333d01fa7 +--- /dev/null ++++ b/src/main/resources/META-INF/services/net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer$Provider +@@ -0,0 +1 @@ ++io.papermc.paper.adventure.providers.PlainTextComponentSerializerProviderImpl +diff --git a/src/test/java/io/papermc/paper/adventure/ComponentServicesTest.java b/src/test/java/io/papermc/paper/adventure/ComponentServicesTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..b6c4f8e2d375396a0ef3300a8bc324d77f23a768 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/adventure/ComponentServicesTest.java +@@ -0,0 +1,23 @@ ++package io.papermc.paper.adventure; ++ ++import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.format.NamedTextColor; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; ++import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; ++import org.junit.Test; ++ ++import static org.junit.Assert.assertEquals; ++ ++public class ComponentServicesTest { ++ ++ @Test ++ public void testPlainTextComponentSerializerProvider() { ++ assertEquals("Done", PlainTextComponentSerializer.plainText().serialize(Component.translatable("narrator.loading.done"))); ++ } ++ ++ @Test ++ public void testLegacyComponentSerializerProvider() { ++ assertEquals("§cDone", LegacyComponentSerializer.legacySection().serialize(Component.translatable("narrator.loading.done", NamedTextColor.RED))); ++ assertEquals("&cDone", LegacyComponentSerializer.legacyAmpersand().serialize(Component.translatable("narrator.loading.done", NamedTextColor.RED))); ++ } ++} diff --git a/patches/server/0082-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/0082-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 64389ced35..db432de505 100644 --- a/patches/server/0082-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/patches/server/0082-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -26,11 +26,11 @@ index 1496ad80007b93255d105942fef19f4f1a069206..f0be60905effc3489ec0050cc456ae88 + } } diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -index 65b6e260464b2003d6bd172610adb5b8651df169..55276e9679dcdc38c6716533e9218f81fc146592 100644 +index 3526bc0b6ad590776124966ea907fe2467cbbf5f..65005e9818ef603724ff8f8041f617f1e602a868 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -15,6 +15,8 @@ import net.kyori.adventure.text.TextReplacementConfig; - import net.kyori.adventure.text.event.ClickEvent; +@@ -16,6 +16,8 @@ import net.kyori.adventure.text.event.ClickEvent; + import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; +import org.bukkit.ChatColor; @@ -38,12 +38,12 @@ index 65b6e260464b2003d6bd172610adb5b8651df169..55276e9679dcdc38c6716533e9218f81 import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.Waitable; -@@ -153,10 +155,16 @@ public final class ChatProcessor { +@@ -154,10 +156,16 @@ public final class ChatProcessor { } private static String legacyDisplayName(final CraftPlayer player) { + if (((CraftWorld) player.getWorld()).getHandle().paperConfig.useVanillaScoreboardColoring) { -+ return PaperAdventure.LEGACY_SECTION_UXRC.serialize(player.teamDisplayName()) + ChatColor.RESET; ++ return LegacyComponentSerializer.legacySection().serialize(player.teamDisplayName()) + ChatColor.RESET; + } return player.getDisplayName(); } diff --git a/patches/server/0132-Use-TerminalConsoleAppender-for-console-improvements.patch b/patches/server/0132-Use-TerminalConsoleAppender-for-console-improvements.patch index 51f883a862..0e8995e4c3 100644 --- a/patches/server/0132-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/patches/server/0132-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -166,7 +166,7 @@ index aa02ab4ea7890d9a477be55ce6c0be0a2a0d4b52..f846d9163ca97901ac1508ef8a476dab @Override public void sendMessage(Component message, UUID sender) { - MinecraftServer.LOGGER.info(message.getString()); -+ MinecraftServer.LOGGER.info(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(io.papermc.paper.adventure.PaperAdventure.asAdventure(message))); // Paper - Log message with colors ++ MinecraftServer.LOGGER.info(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(io.papermc.paper.adventure.PaperAdventure.asAdventure(message))); // Paper - Log message with colors } public KeyPair getKeyPair() { @@ -222,7 +222,7 @@ index b99c1b62ce01700d5c374a1801e8323d5906255c..39a24292f215920bc3121f4ac903040d System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5b1dcf148d24bbd61728d8c2af611b7c4f8dd166..03fc0bca0c1a11db43d315236ca05dfea137ddb3 100644 +index 17afebfc2091392c5ec9aa9f6734ff71d67c9dac..caf92576ed2023f721810b7dd09dd194b1cb3d8c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -155,8 +155,7 @@ public abstract class PlayerList { diff --git a/patches/server/0146-ProfileWhitelistVerifyEvent.patch b/patches/server/0146-ProfileWhitelistVerifyEvent.patch index 02967097cc..2191e69d7d 100644 --- a/patches/server/0146-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0146-ProfileWhitelistVerifyEvent.patch @@ -14,7 +14,7 @@ index 03fc0bca0c1a11db43d315236ca05dfea137ddb3..a1ca0c0c08f6793ce3440733f802a40f event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure - } else if (!this.isWhiteListed(gameprofile)) { - chatmessage = new TranslatableComponent("multiplayer.disconnect.not_whitelisted"); -- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure +- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure + } else if (!this.isWhitelisted(gameprofile, event)) { // Paper + //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper + //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted @@ -38,7 +38,7 @@ index 03fc0bca0c1a11db43d315236ca05dfea137ddb3..a1ca0c0c08f6793ce3440733f802a40f + event.callEvent(); + if (!event.isWhitelisted()) { + if (loginEvent != null) { -+ loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(event.getKickMessage() == null ? org.spigotmc.SpigotConfig.whitelistMessage : event.getKickMessage())); ++ loginEvent.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(event.getKickMessage() == null ? org.spigotmc.SpigotConfig.whitelistMessage : event.getKickMessage())); + } + return false; + } diff --git a/patches/server/0281-Restore-custom-InventoryHolder-support.patch b/patches/server/0281-Restore-custom-InventoryHolder-support.patch index 62f1b3a9b0..e6bd4912aa 100644 --- a/patches/server/0281-Restore-custom-InventoryHolder-support.patch +++ b/patches/server/0281-Restore-custom-InventoryHolder-support.patch @@ -11,14 +11,15 @@ outside of custom inventories. diff --git a/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java b/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java new file mode 100644 -index 0000000000000000000000000000000000000000..8e02633b2f8676095ca5c5326c88499a8f36c842 +index 0000000000000000000000000000000000000000..224d4b2cc45b0d02230a76caee9c88573a448b4c --- /dev/null +++ b/src/main/java/io/papermc/paper/inventory/PaperInventoryCustomHolderContainer.java -@@ -0,0 +1,140 @@ +@@ -0,0 +1,141 @@ +package io.papermc.paper.inventory; + +import io.papermc.paper.adventure.PaperAdventure; +import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; @@ -55,7 +56,7 @@ index 0000000000000000000000000000000000000000..8e02633b2f8676095ca5c5326c88499a + adventure$title = type.defaultTitle(); + } + this.adventure$title = adventure$title; -+ this.title = PaperAdventure.LEGACY_SECTION_UXRC.serialize(this.adventure$title); ++ this.title = LegacyComponentSerializer.legacySection().serialize(this.adventure$title); + } + + public Component title() { @@ -202,7 +203,7 @@ index 6ca8e76d1569f3f631275fea187e7110f09fc69e..3796f8b122ad981b6faacd2afcaf3696 return InventoryType.ENDER_CHEST; } else if (this.inventory instanceof MerchantContainer) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -index 08fc05836b26f5f93ae74324705d5f593b57315a..fdde2b3f2320393ab4acf450d08ab6744c5408ea 100644 +index f3ebaefd949ae73afad3dcb69b8d9c632cc782f7..08f8ea0716ef8fa850f1f2f7b8a6e636f57ae872 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -15,6 +15,11 @@ import org.bukkit.event.inventory.InventoryType; diff --git a/patches/server/0391-Prevent-opening-inventories-when-frozen.patch b/patches/server/0391-Prevent-opening-inventories-when-frozen.patch index 223a9d52d5..8edf5911bb 100644 --- a/patches/server/0391-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0391-Prevent-opening-inventories-when-frozen.patch @@ -31,7 +31,7 @@ index adfbc156b4c4a8591609f385adaa6b04f984a64f..709bab9ac4eb453caeb0f565b6a0d6d0 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -322,7 +322,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(container.getBukkitView().getTitle()); // Paper + if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(container.getBukkitView().getTitle()); // Paper //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper // Paper - comment - player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper @@ -41,7 +41,7 @@ index adfbc156b4c4a8591609f385adaa6b04f984a64f..709bab9ac4eb453caeb0f565b6a0d6d0 } @@ -396,7 +396,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { net.kyori.adventure.text.Component adventure$title = inventory.title(); // Paper - if (adventure$title == null) adventure$title = io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(inventory.getTitle()); // Paper + if (adventure$title == null) adventure$title = net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(inventory.getTitle()); // Paper //player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper - comment - player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper + if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper diff --git a/patches/server/0426-Add-option-for-console-having-all-permissions.patch b/patches/server/0426-Add-option-for-console-having-all-permissions.patch index 4efacab310..5c9e2f0b04 100644 --- a/patches/server/0426-Add-option-for-console-having-all-permissions.patch +++ b/patches/server/0426-Add-option-for-console-having-all-permissions.patch @@ -19,12 +19,12 @@ index 045a49da7c17e48534b3bd5b7aa3968963681e6c..5dc7e897fdb2a572b800eb34c40961cd + } } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java -index 269738c499c6aab6f8c39ba4ffd12fa09f0d79dc..dbff1eda25b02b16ec123515338d470489f3b3c4 100644 +index 324e6d1a4fadd3e557e4ba05f04e6a5891cc54df..db77cdee224d14ec91e8d530dd65da51f3661a9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java @@ -93,5 +93,15 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) { - this.sendRawMessage(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(message)); + this.sendRawMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message)); } + + @Override diff --git a/patches/server/0504-Lazily-track-plugin-scoreboards-by-default.patch b/patches/server/0504-Lazily-track-plugin-scoreboards-by-default.patch index ec35b04d4f..cafd24af42 100644 --- a/patches/server/0504-Lazily-track-plugin-scoreboards-by-default.patch +++ b/patches/server/0504-Lazily-track-plugin-scoreboards-by-default.patch @@ -66,7 +66,7 @@ index 5f2af880619e01a03e05258ae1f9fa58110f7f2a..944080939ceaf2db8bcd7d3c01f4b974 + // Paper end ScoreboardObjective objective = board.registerObjective(name, craftCriteria.criteria, CraftChatMessage.fromStringOrNull(displayName), CraftScoreboardTranslations.fromBukkitRender(renderType)); return new CraftObjective(this, objective);*/ // Paper - return registerNewObjective(name, criteria, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(displayName), renderType); // Paper + return registerNewObjective(name, criteria, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(displayName), renderType); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java index ff090edcc85713083449cebb22bd1490123bc1ee..8ccfe9488db44d7d2cf4040a5b4cead33da1d5f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java diff --git a/patches/server/0595-Add-support-for-hex-color-codes-in-console.patch b/patches/server/0595-Add-support-for-hex-color-codes-in-console.patch index cd8f46da31..5a7a286607 100644 --- a/patches/server/0595-Add-support-for-hex-color-codes-in-console.patch +++ b/patches/server/0595-Add-support-for-hex-color-codes-in-console.patch @@ -6,7 +6,7 @@ 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. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index a0a3cec47c8f9e379a5bc1d43eeda5eb9d81f814..23d849872109e43d6e22a953d3a4298565d4621d 100644 +index 1adbceadd5df96e17796561a40eb7b760493440e..c07257314e070d4423c4f53f58cb0962e3ead131 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -454,8 +454,10 @@ public class PaperConfig { @@ -21,17 +21,17 @@ index a0a3cec47c8f9e379a5bc1d43eeda5eb9d81f814..23d849872109e43d6e22a953d3a42985 public static boolean allowBlockPermanentBreakingExploits = false; diff --git a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java -index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..84243e10c115104cadfe84c4f152f53c1b5f7c6f 100644 +index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..709f2a420ceaffe0101c676ec23e949e8d684465 100644 --- a/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java +++ b/src/main/java/com/destroystokyo/paper/console/TerminalConsoleCommandSender.java @@ -1,5 +1,10 @@ package com.destroystokyo.paper.console; -+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.console.HexFormattingConverter; +import net.kyori.adventure.audience.MessageType; +import net.kyori.adventure.identity.Identity; +import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.craftbukkit.command.CraftConsoleCommandSender; @@ -41,7 +41,7 @@ index 685deaa0e5d1ddc13e3a7c0471b1cfcf1710c869..84243e10c115104cadfe84c4f152f53c public void sendRawMessage(String message) { - // TerminalConsoleAppender supports color codes directly in log messages - LOGGER.info(message); -+ final Component msg = PaperAdventure.LEGACY_SECTION_UXRC.deserialize(message); ++ final Component msg = LegacyComponentSerializer.legacySection().deserialize(message); + this.sendMessage(Identity.nil(), msg, MessageType.SYSTEM); + } + @@ -270,14 +270,14 @@ index 0000000000000000000000000000000000000000..ea83ee8762c126c449993a7497257b0b + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 445efad6a35b819dcb845524a28055a90da6e7f6..2914355be3f6c45b2dbd7ceb0ea65c7f22255a6d 100644 +index 3a73d834c3c8481ff3af3eee7634309f7abe60ab..2914355be3f6c45b2dbd7ceb0ea65c7f22255a6d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1712,7 +1712,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @Override public void sendMessage(Component message, UUID sender) { -- MinecraftServer.LOGGER.info(io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.serialize(io.papermc.paper.adventure.PaperAdventure.asAdventure(message))); // Paper - Log message with colors +- MinecraftServer.LOGGER.info(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(io.papermc.paper.adventure.PaperAdventure.asAdventure(message))); // Paper - Log message with colors + MinecraftServer.LOGGER.info(io.papermc.paper.console.HexFormattingConverter.SERIALIZER.serialize(io.papermc.paper.adventure.PaperAdventure.asAdventure(message))); // Paper - Log message with colors } diff --git a/patches/server/0659-Add-PlayerKickEvent-causes.patch b/patches/server/0659-Add-PlayerKickEvent-causes.patch index 0bdfea813c..13b36bb75d 100644 --- a/patches/server/0659-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0659-Add-PlayerKickEvent-causes.patch @@ -100,12 +100,12 @@ index 50797b32b71b2c8a73f34313021457b27fc90660..7ad1b8b836d692b1168609e96e4eb72e public void disconnect(String s) { // Paper start -- this.disconnect(PaperAdventure.LEGACY_SECTION_UXRC.deserialize(s)); -+ this.disconnect(PaperAdventure.LEGACY_SECTION_UXRC.deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); +- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); + } + + public void disconnect(String s, PlayerKickEvent.Cause cause) { -+ this.disconnect(PaperAdventure.LEGACY_SECTION_UXRC.deserialize(s), cause); ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause); } public void disconnect(final Component reason) { diff --git a/patches/server/0846-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/0846-API-for-creating-command-sender-which-forwards-feedb.patch index 3c63313178..0b8985beaf 100644 --- a/patches/server/0846-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/0846-API-for-creating-command-sender-which-forwards-feedb.patch @@ -6,19 +6,19 @@ Subject: [PATCH] API for creating command sender which forwards feedback diff --git a/src/main/java/io/papermc/paper/commands/FeedbackForwardingSender.java b/src/main/java/io/papermc/paper/commands/FeedbackForwardingSender.java new file mode 100644 -index 0000000000000000000000000000000000000000..f7c86155ce0cfd9b4bf8a2b79d77a656d795c95f +index 0000000000000000000000000000000000000000..ed3d488c6581df5eac425d9cccb8e741a52e91d5 --- /dev/null +++ b/src/main/java/io/papermc/paper/commands/FeedbackForwardingSender.java @@ -0,0 +1,112 @@ +package io.papermc.paper.commands; + +import io.papermc.paper.adventure.PaperAdventure; -+import io.papermc.paper.text.PaperComponents; +import java.util.UUID; +import java.util.function.Consumer; +import net.kyori.adventure.audience.MessageType; +import net.kyori.adventure.identity.Identity; +import net.kyori.adventure.text.Component; ++import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; +import net.minecraft.commands.CommandSource; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.TextComponent; @@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..f7c86155ce0cfd9b4bf8a2b79d77a656 + + @Override + public void sendMessage(final String message) { -+ this.sendMessage(PaperComponents.legacySectionSerializer().deserialize(message)); ++ this.sendMessage(LegacyComponentSerializer.legacySection().deserialize(message)); + } + + @Override @@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..f7c86155ce0cfd9b4bf8a2b79d77a656 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7dc79e7c552d7ebc2dea9248c2d5647b5a6895e0..66d931bf247cfc07c40ef4721ab24e163e6038ea 100644 +index 168893fe1790edac8fee884b1fae4e6b7a1bd5c6..231a7935950d40683c8538bfcfc8adea236ad37a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1988,6 +1988,13 @@ public final class CraftServer implements Server { |