mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 07:32:03 -07:00
Move to configurate for paper.yml (#7609)
This commit is contained in:
@@ -4,30 +4,6 @@ Date: Fri, 4 Jun 2021 12:12:35 -0700
|
||||
Subject: [PATCH] Make item validations configurable
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperConfig {
|
||||
config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
|
||||
allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
|
||||
}
|
||||
+
|
||||
+ public static int itemValidationDisplayNameLength = 8192;
|
||||
+ public static int itemValidationLocNameLength = 8192;
|
||||
+ public static int itemValidationLoreLineLength = 8192;
|
||||
+ public static int itemValidationBookTitleLength = 8192;
|
||||
+ public static int itemValidationBookAuthorLength = 8192;
|
||||
+ public static int itemValidationBookPageLength = 16384;
|
||||
+ private static void itemValidationSettings() {
|
||||
+ itemValidationDisplayNameLength = getInt("settings.item-validation.display-name", itemValidationDisplayNameLength);
|
||||
+ itemValidationLocNameLength = getInt("settings.item-validation.loc-name", itemValidationLocNameLength);
|
||||
+ itemValidationLoreLineLength = getInt("settings.item-validation.lore-line", itemValidationLoreLineLength);
|
||||
+ itemValidationBookTitleLength = getInt("settings.item-validation.book.title", itemValidationBookTitleLength);
|
||||
+ itemValidationBookAuthorLength = getInt("settings.item-validation.book.author", itemValidationBookAuthorLength);
|
||||
+ itemValidationBookPageLength = getInt("settings.item-validation.book.page", itemValidationBookPageLength);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
||||
@@ -37,12 +13,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (tag.contains(BOOK_TITLE.NBT)) {
|
||||
- this.title = limit( tag.getString(BOOK_TITLE.NBT), 8192 ); // Spigot
|
||||
+ this.title = limit( tag.getString(BOOK_TITLE.NBT), com.destroystokyo.paper.PaperConfig.itemValidationBookTitleLength); // Spigot // Paper - make configurable
|
||||
+ this.title = limit( tag.getString(BOOK_TITLE.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.title); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (tag.contains(BOOK_AUTHOR.NBT)) {
|
||||
- this.author = limit( tag.getString(BOOK_AUTHOR.NBT), 8192 ); // Spigot
|
||||
+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), com.destroystokyo.paper.PaperConfig.itemValidationBookAuthorLength ); // Spigot // Paper - make configurable
|
||||
+ this.author = limit( tag.getString(BOOK_AUTHOR.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.author ); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (tag.contains(RESOLVED.NBT)) {
|
||||
@@ -51,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
page = this.validatePage(page);
|
||||
}
|
||||
- this.pages.add( limit( page, 16384 ) ); // Spigot
|
||||
+ this.pages.add( limit( page, com.destroystokyo.paper.PaperConfig.itemValidationBookPageLength ) ); // Spigot // Paper - make configurable
|
||||
+ this.pages.add( limit( page, io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.book.page ) ); // Spigot // Paper - make configurable
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -64,12 +40,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
if (display.contains(NAME.NBT)) {
|
||||
- this.displayName = limit( display.getString(NAME.NBT), 8192 ); // Spigot
|
||||
+ this.displayName = limit( display.getString(NAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationDisplayNameLength ); // Spigot // Paper - make configurable
|
||||
+ this.displayName = limit( display.getString(NAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.displayName ); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (display.contains(LOCNAME.NBT)) {
|
||||
- this.locName = limit( display.getString(LOCNAME.NBT), 8192 ); // Spigot
|
||||
+ this.locName = limit( display.getString(LOCNAME.NBT), com.destroystokyo.paper.PaperConfig.itemValidationLocNameLength ); // Spigot // Paper - make configurable
|
||||
+ this.locName = limit( display.getString(LOCNAME.NBT), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.locName ); // Spigot // Paper - make configurable
|
||||
}
|
||||
|
||||
if (display.contains(LORE.NBT)) {
|
||||
@@ -77,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.lore = new ArrayList<String>(list.size());
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
- String line = limit( list.getString(index), 8192 ); // Spigot
|
||||
+ String line = limit( list.getString(index), com.destroystokyo.paper.PaperConfig.itemValidationLoreLineLength ); // Spigot // Paper - make configurable
|
||||
+ String line = limit( list.getString(index), io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.loreLine ); // Spigot // Paper - make configurable
|
||||
this.lore.add(line);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user