From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 10 Feb 2021 14:53:36 -0800 Subject: [PATCH] Merchant#getRecipes should return an immutable list diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java index 425c8de426cecc9919d03dc64325494104d1b294..fcd6574857f77d547fd8101c5ac097bc6306034c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java @@ -24,7 +24,7 @@ public class CraftMerchant implements Merchant { @Override public List getRecipes() { - return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function() { + return com.google.common.collect.ImmutableList.copyOf(Lists.transform(this.merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) @Override public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) { return recipe.asBukkit();