mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-14 07:58:02 +02:00
aa52bf9e33
Mojang made some changes to priorities in 1.17 and it seems that these changes conflict with the changes made in this patch, which in some cases appears to cause excessive rescheduling of tasks. This, however, is not confirmed as such but seems to be the behavior that we're seeing to cause this issue, if mojang has adopted the changes we suggested, then a good chunk of this patch may be unneeded, but, this needs a much better look than I'm currently able to do
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();
|