mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 03:32:46 +01:00
6f2009754d
At the time this was re-added, there was concern around how the JIT would handle the system property that enabled it. This shouldn't be a problem, and as such we no longer need to block access to it. The Vanilla Method Profiler will not provide much to most users however there is no harm in providing it as an option. For most users, the recommended and supported method for determining performance issues with Paper will continue to be Timings.
61 lines
2.9 KiB
Diff
61 lines
2.9 KiB
Diff
From 164188358ca9ad1cb4a0769c211922fe5d92ab07 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 6fab8cd1..d8684eed 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 = 50;
|
|
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;
|
|
@@ -196,7 +197,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;
|
|
}
|
|
|
|
@@ -232,7 +233,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
throw new IllegalArgumentException("Invalid page number " + page + "/" + pages.size());
|
|
}
|
|
|
|
- String newText = text == null ? "" : text.length() > MAX_PAGE_LENGTH ? text.substring(0, MAX_PAGE_LENGTH) : text;
|
|
+ String newText = text == null ? "" : text.length() > MAX_PAGE_LENGTH && !OVERRIDE_CHECKS ? text.substring(0, MAX_PAGE_LENGTH) : text;
|
|
pages.set(page - 1, CraftChatMessage.fromString(newText, true)[0]);
|
|
}
|
|
|
|
@@ -244,13 +245,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
|
|
public void addPage(final String... pages) {
|
|
for (String page : pages) {
|
|
- if (this.pages.size() >= MAX_PAGES) {
|
|
+ if (this.pages.size() >= MAX_PAGES && !OVERRIDE_CHECKS) {
|
|
return;
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
--
|
|
2.14.3
|
|
|