Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Enforce proper limits on books.
Dieser Commit ist enthalten in:
Ursprung
be9ef980b9
Commit
4acd0f49e0
@ -29,8 +29,9 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
static final ItemMetaKey BOOK_PAGES = new ItemMetaKey("pages");
|
||||
static final ItemMetaKey RESOLVED = new ItemMetaKey("resolved");
|
||||
static final ItemMetaKey GENERATION = new ItemMetaKey("generation");
|
||||
static final int MAX_PAGE_LENGTH = Short.MAX_VALUE; // TODO: Check me
|
||||
static final int MAX_TITLE_LENGTH = 0xffff;
|
||||
static final int MAX_PAGES = 50;
|
||||
static final int MAX_PAGE_LENGTH = 256;
|
||||
static final int MAX_TITLE_LENGTH = 16;
|
||||
|
||||
protected String title;
|
||||
protected String author;
|
||||
@ -235,6 +236,10 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
||||
|
||||
public void addPage(final String... pages) {
|
||||
for (String page : pages) {
|
||||
if (this.pages.size() >= MAX_PAGES) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (page == null) {
|
||||
page = "";
|
||||
} else if (page.length() > MAX_PAGE_LENGTH) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren