From 86f87ba40030d719e5fb8840ab18c513588de772 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Mon, 25 Jul 2022 19:21:31 +0200 Subject: [PATCH] Fix custom merchant trade event world reference --- .../0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/server/0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index aa909b26d..e02f2667c 100644 --- a/patches/server/0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/0542-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -219,7 +219,7 @@ index d41f44ed2e497ba3373d170c08488b49e88334c4..d3a99ba6f3085ad12b67ddc94cc4ab39 void notifyTradeUpdated(ItemStack stack); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index 257776a12ca26c1e75be22a67c94b0aa012fd687..02fc14d84df08d9e0418691f6c6b71f013e16365 100644 +index 257776a12ca26c1e75be22a67c94b0aa012fd687..5074e8b2259b3fb969bd0ff99c296b7537920273 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -74,10 +74,25 @@ public class CraftMerchantCustom extends CraftMerchant { @@ -235,7 +235,7 @@ index 257776a12ca26c1e75be22a67c94b0aa012fd687..02fc14d84df08d9e0418691f6c6b71f0 + merchantRecipe.increaseUses(); + } + if (event == null || event.isRewardingExp()) { -+ this.tradingWorld.addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(tradingWorld, tradingPlayer.getX(), tradingPlayer.getY(), tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); ++ this.tradingPlayer.level.addFreshEntity(new net.minecraft.world.entity.ExperienceOrb(tradingPlayer.level, tradingPlayer.getX(), tradingPlayer.getY(), tradingPlayer.getZ(), merchantRecipe.getXp(), org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.tradingPlayer, null)); + } + } + this.notifyTrade(merchantRecipe);