mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-16 15:45:23 +01:00
20 lines
1.4 KiB
Diff
20 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: jmp <jasonpenilla2@me.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 00d43e4a77ed03bc9672cbaccad50b48aed0fb93..3c66d9217eb0b60595a59e2f296de332095d4a4c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java
|
|
@@ -25,7 +25,7 @@ public class CraftMerchant implements Merchant {
|
|
|
|
@Override
|
|
public List<MerchantRecipe> getRecipes() {
|
|
- return Collections.unmodifiableList(Lists.transform(merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantRecipe, MerchantRecipe>() {
|
|
+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantRecipe, 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.MerchantRecipe recipe) {
|
|
return recipe.asBukkit();
|