SPIGOT-4651: MerchantRecipe.setIngredients() allows more than 2 ingredients

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot 2019-03-06 19:45:39 +11:00
parent a9891b05f1
commit 57acb14157

View file

@ -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<ItemStack> ingredients) {
Preconditions.checkState(ingredients.size() <= 2, "MerchantRecipe can only have maximum 2 ingredients");
this.ingredients = new ArrayList<ItemStack>();
for (ItemStack item : ingredients) {
this.ingredients.add(item.clone());