Fix custom merchant trade event world reference

This commit is contained in:
Nassim Jahnke 2022-07-25 19:21:31 +02:00
parent 345a6a6205
commit 86f87ba400
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -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);