mirror of
https://github.com/PaperMC/Paper.git
synced 2024-08-31 09:09:56 +02:00
20 lines
1.4 KiB
Diff
20 lines
1.4 KiB
Diff
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<MerchantRecipe> getRecipes() {
|
|
- return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() {
|
|
+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(this.merchant.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();
|