geforkt von Mirrors/Paper
Allow server administrators to disable book size checks (#10457)
Dieser Commit ist enthalten in:
Ursprung
9921a197e7
Commit
3ab4933ea3
@ -30,10 +30,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Override
|
@Override
|
||||||
public void handleEditBook(ServerboundEditBookPacket packet) {
|
public void handleEditBook(ServerboundEditBookPacket packet) {
|
||||||
+ // Paper start - Book size limits
|
+ // 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<String> pageList = packet.pages();
|
+ final List<String> pageList = packet.pages();
|
||||||
+ long byteTotal = 0;
|
+ 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);
|
+ final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D);
|
||||||
+ long byteAllowed = maxBookPageSize;
|
+ long byteAllowed = maxBookPageSize;
|
||||||
+ for (final String page : pageList) {
|
+ for (final String page : pageList) {
|
||||||
|
@ -513,6 +513,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import java.util.List;
|
+import java.util.List;
|
||||||
+import java.util.Map;
|
+import java.util.Map;
|
||||||
+import java.util.Objects;
|
+import java.util.Objects;
|
||||||
|
+import java.util.OptionalInt;
|
||||||
+
|
+
|
||||||
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
|
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"})
|
||||||
+public class GlobalConfiguration extends ConfigurationPart {
|
+public class GlobalConfiguration extends ConfigurationPart {
|
||||||
@ -723,7 +724,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public BookSize bookSize;
|
+ public BookSize bookSize;
|
||||||
+
|
+
|
||||||
+ public class BookSize extends ConfigurationPart {
|
+ 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 double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class
|
||||||
+ }
|
+ }
|
||||||
+ public boolean resolveSelectorsInBooks = false;
|
+ public boolean resolveSelectorsInBooks = false;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren