diff --git a/patches/server/Book-size-limits.patch b/patches/server/Book-size-limits.patch index 1a31776a61..4edc054d55 100644 --- a/patches/server/Book-size-limits.patch +++ b/patches/server/Book-size-limits.patch @@ -30,10 +30,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void handleEditBook(ServerboundEditBookPacket packet) { + // Paper start - Book size limits -+ if (!this.cserver.isPrimaryThread()) { ++ final io.papermc.paper.configuration.type.number.IntOr.Disabled pageMax = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; ++ if (!this.cserver.isPrimaryThread() && pageMax.enabled()) { + final List pageList = packet.pages(); + long byteTotal = 0; -+ final int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; ++ final int maxBookPageSize = pageMax.intValue(); + final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D); + long byteAllowed = maxBookPageSize; + for (final String page : pageList) { diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index 8947af73b5..3b8ed6ab03 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -513,6 +513,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.List; +import java.util.Map; +import java.util.Objects; ++import java.util.OptionalInt; + +@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) +public class GlobalConfiguration extends ConfigurationPart { @@ -723,7 +724,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public BookSize bookSize; + + public class BookSize extends ConfigurationPart { -+ public int pageMax = 2560; // TODO this appears to be a duplicate setting with one above ++ public IntOr.Disabled pageMax = new IntOr.Disabled(OptionalInt.of(2560)); // TODO this appears to be a duplicate setting with one above + public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class + } + public boolean resolveSelectorsInBooks = false;