From 57acb141570c616be14f664cbb3d67bd1545a2fc Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 6 Mar 2019 19:45:39 +1100 Subject: [PATCH] SPIGOT-4651: MerchantRecipe.setIngredients() allows more than 2 ingredients By: md_5 --- .../src/main/java/org/bukkit/inventory/MerchantRecipe.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/inventory/MerchantRecipe.java b/paper-api/src/main/java/org/bukkit/inventory/MerchantRecipe.java index 9a03d20eef..54e29d545d 100644 --- a/paper-api/src/main/java/org/bukkit/inventory/MerchantRecipe.java +++ b/paper-api/src/main/java/org/bukkit/inventory/MerchantRecipe.java @@ -43,7 +43,7 @@ public class MerchantRecipe implements Recipe { } public void addIngredient(ItemStack item) { - Preconditions.checkState(ingredients.size() < 2, "MerchantRecipe can only have 2 ingredients"); + Preconditions.checkState(ingredients.size() < 2, "MerchantRecipe can only have maximum 2 ingredients"); ingredients.add(item.clone()); } @@ -52,6 +52,7 @@ public class MerchantRecipe implements Recipe { } public void setIngredients(List ingredients) { + Preconditions.checkState(ingredients.size() <= 2, "MerchantRecipe can only have maximum 2 ingredients"); this.ingredients = new ArrayList(); for (ItemStack item : ingredients) { this.ingredients.add(item.clone());