From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: jmp 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 3437ec2c7c1a84debb7d7b7c90283d7e25208604..b4bcbd6329c67ea3deeeb1bf38233ebd15e922b7 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(merchant.getOffers(), new Function() { + return com.google.common.collect.ImmutableList.copyOf(Lists.transform(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();