mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-15 07:05:44 +01:00
b31089a929
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: d264e972 #591: Add option for a consumer before spawning an item 1c537fce #590: Add spawn and transform reasons for piglin zombification. CraftBukkit Changes: ee5006d1 #810: Add option for a consumer before spawning an item f6a39d3c #809: Add spawn and transform reasons for piglin zombification. 0c24068a Organise imports Spigot Changes: bff52619 Organise imports
52 lines
2.6 KiB
Diff
52 lines
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
Date: Sat, 13 May 2017 20:11:21 -0500
|
|
Subject: [PATCH] Add system property to disable book size limits
|
|
|
|
If anyone comes in with a watchdog crash related to books after this patch
|
|
you will not only be publicly shamed but also made an example of.
|
|
|
|
Disables the security limits on books entirely, allowing plugins AND players
|
|
to make books with as much data as they want. Do not use this without
|
|
limiting incoming data from packets in some other way.
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
index 123616ed018fbc4d69f46e65d5ff15734008a00d..34449ac7899abbc863266da1e6197873f80940b0 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
@@ -40,6 +40,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
static final int MAX_PAGES = 100;
|
|
static final int MAX_PAGE_LENGTH = 320; // 256 limit + 64 characters to allow for psuedo colour codes
|
|
static final int MAX_TITLE_LENGTH = 32;
|
|
+ private static final boolean OVERRIDE_CHECKS = Boolean.getBoolean("disable.book-limits"); // Paper - Add override
|
|
|
|
protected String title;
|
|
protected String author;
|
|
@@ -242,7 +243,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
if (title == null) {
|
|
this.title = null;
|
|
return true;
|
|
- } else if (title.length() > MAX_TITLE_LENGTH) {
|
|
+ } else if (title.length() > MAX_TITLE_LENGTH && !OVERRIDE_CHECKS) { // Paper - Add override
|
|
return false;
|
|
}
|
|
|
|
@@ -433,7 +434,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
String validatePage(String page) {
|
|
if (page == null) {
|
|
page = "";
|
|
- } else if (page.length() > MAX_PAGE_LENGTH) {
|
|
+ } else if (page.length() > MAX_PAGE_LENGTH && !OVERRIDE_CHECKS) { // Paper - Add override
|
|
page = page.substring(0, MAX_PAGE_LENGTH);
|
|
}
|
|
return page;
|
|
@@ -443,7 +444,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
// asserted: page != null
|
|
if (this.pages == null) {
|
|
this.pages = new ArrayList<String>();
|
|
- } else if (this.pages.size() >= MAX_PAGES) {
|
|
+ } else if (this.pages.size() >= MAX_PAGES && !OVERRIDE_CHECKS) {// Paper - Add override
|
|
return;
|
|
}
|
|
this.pages.add(page);
|