diff options
author | Jake Potrebic <[email protected]> | 2024-04-28 09:46:30 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-28 09:46:33 -0700 |
commit | 0f4d328fc1e4bfff5ceb7cce0238a9baf8b03ab3 (patch) | |
tree | 52de22471fd8aec8c34bb71a1d925888178212d3 | |
parent | aed7dcab984bd42621e5ef00e29c0f89fe3ec53c (diff) | |
download | Paper-0f4d328fc1e4bfff5ceb7cce0238a9baf8b03ab3.tar.gz Paper-0f4d328fc1e4bfff5ceb7cce0238a9baf8b03ab3.zip |
final missing validation for data components
-rw-r--r-- | patches/server/1045-General-ItemMeta-fixes.patch | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/patches/server/1045-General-ItemMeta-fixes.patch b/patches/server/1045-General-ItemMeta-fixes.patch index 65b160a69b..431872ab6c 100644 --- a/patches/server/1045-General-ItemMeta-fixes.patch +++ b/patches/server/1045-General-ItemMeta-fixes.patch @@ -251,6 +251,18 @@ index 05a4a06c0def28fc97e61b4712c45c8730fec60c..a86eb660d8f523cb99a0b668ef113053 + } + // Paper end - General ItemMeta Fixes } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java +index c68e85cca0f532a94545c0b7f6ed54451ce5a47e..eb08b3453738bffd1a6350dc56c18b9740be5a01 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java +@@ -103,6 +103,7 @@ public final class CraftFoodComponent implements FoodComponent { + + @Override + public void setEatSeconds(float eatSeconds) { ++ Preconditions.checkArgument(eatSeconds > 0, "Eat seconds must be positive"); // Paper - validate eat_seconds + this.handle = new FoodProperties(this.handle.nutrition(), this.handle.saturation(), this.handle.canAlwaysEat(), eatSeconds, this.handle.effects()); + } + diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java index 0b11d5ea89539decd2f6c60c5b581bbd78ff1fd6..74ebadacbbd11b5a0d8f8c6cd6409cce17cfa37d 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/DeprecatedItemMetaCustomValueTest.java |