mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 20:52:12 -07:00
Prepare for 1.19 dev
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 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
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
private static void useProxyProtocol() {
|
||||
useProxyProtocol = getBoolean("settings.proxy-protocol", false);
|
||||
}
|
||||
+
|
||||
+ public static boolean resolveSelectorsInBooks;
|
||||
+ private static void resolveSelectorsInBooks() {
|
||||
+ resolveSelectorsInBooks = getBoolean("settings.resolve-selectors-in-books", false);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
|
||||
@@ -0,0 +0,0 @@ public class WrittenBookItem extends Item {
|
||||
|
||||
public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) {
|
||||
CompoundTag compoundTag = book.getTag();
|
||||
- if (compoundTag != null && !compoundTag.getBoolean("resolved")) {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.resolveSelectorsInBooks && compoundTag != null && !compoundTag.getBoolean("resolved")) { // Paper
|
||||
compoundTag.putBoolean("resolved", true);
|
||||
if (!makeSureTagIsValid(compoundTag)) {
|
||||
return false;
|
||||
} else {
|
||||
ListTag listTag = compoundTag.getList("pages", 8);
|
||||
+ // Paper start - backport length limit
|
||||
+ ListTag newPages = new ListTag();
|
||||
|
||||
for(int i = 0; i < listTag.size(); ++i) {
|
||||
- listTag.set(i, (Tag)StringTag.valueOf(resolvePage(commandSource, player, listTag.getString(i))));
|
||||
+ String resolvedPage = resolvePage(commandSource, player, listTag.getString(i));
|
||||
+ if (resolvedPage.length() > 32767) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ newPages.add(i, StringTag.valueOf(resolvedPage));
|
||||
}
|
||||
|
||||
if (compoundTag.contains("filtered_pages", 10)) {
|
||||
CompoundTag compoundTag2 = compoundTag.getCompound("filtered_pages");
|
||||
+ CompoundTag newFilteredPages = new CompoundTag();
|
||||
|
||||
for(String string : compoundTag2.getAllKeys()) {
|
||||
- compoundTag2.putString(string, resolvePage(commandSource, player, compoundTag2.getString(string)));
|
||||
+ String resolvedPage = resolvePage(commandSource, player, compoundTag2.getString(string));
|
||||
+ if (resolvedPage.length() > 32767) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ newFilteredPages.putString(string, resolvedPage);
|
||||
}
|
||||
+
|
||||
+ compoundTag.put("filtered_pages", newFilteredPages);
|
||||
}
|
||||
|
||||
+ compoundTag.put("pages", newPages);
|
||||
+ // Paper end
|
||||
return true;
|
||||
}
|
||||
} else {
|
Reference in New Issue
Block a user