From 1be6fca1f193dac87f15e44ee9fdf74096a8289a Mon Sep 17 00:00:00 2001 From: Nassim Jahnke <nassim@njahnke.dev> Date: Thu, 2 Jun 2022 20:35:58 +0200 Subject: [PATCH] Disable component selector resolving in books by default --- .../minecraft/world/item/WrittenBookItem.java.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 paper-server/patches/sources/net/minecraft/world/item/WrittenBookItem.java.patch diff --git a/paper-server/patches/sources/net/minecraft/world/item/WrittenBookItem.java.patch b/paper-server/patches/sources/net/minecraft/world/item/WrittenBookItem.java.patch new file mode 100644 index 0000000000..f29d9ca860 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/item/WrittenBookItem.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/item/WrittenBookItem.java ++++ b/net/minecraft/world/item/WrittenBookItem.java +@@ -41,7 +41,7 @@ + + public static boolean resolveBookComponents(ItemStack book, CommandSourceStack commandSource, @Nullable Player player) { + WrittenBookContent writtenBookContent = book.get(DataComponents.WRITTEN_BOOK_CONTENT); +- if (writtenBookContent != null && !writtenBookContent.resolved()) { ++ if (io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.resolveSelectorsInBooks && writtenBookContent != null && !writtenBookContent.resolved()) { // Paper - Disable component selector resolving in books by default + WrittenBookContent writtenBookContent2 = writtenBookContent.resolve(commandSource, player); + if (writtenBookContent2 != null) { + book.set(DataComponents.WRITTEN_BOOK_CONTENT, writtenBookContent2);