Merchant#getRecipes should return an immutable list

This commit is contained in:
Jason Penilla 2021-02-10 14:53:36 -08:00
parent f8a55d3645
commit 41fd1852ae

View file

@ -16,7 +16,7 @@ public interface CraftMerchant extends Merchant {
@Override
default List<MerchantRecipe> getRecipes() {
return Collections.unmodifiableList(Lists.transform(this.getMerchant().getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() {
return List.copyOf(Lists.transform(this.getMerchant().getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { // 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();