From 6d504c2d4c4eb5b7340fc9156303b791fee37735 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 24 Apr 2019 10:10:41 +1000 Subject: [PATCH] SPIGOT-4725: Virtual Merchant GUI crashes server --- .../bukkit/craftbukkit/inventory/CraftMerchantCustom.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java index bc9359001f..0c10b001a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -31,6 +31,7 @@ public class CraftMerchantCustom extends CraftMerchant { private final IChatBaseComponent title; private final MerchantRecipeList trades = new MerchantRecipeList(); private EntityHuman tradingPlayer; + private World tradingWorld; public MinecraftMerchant(String title) { Validate.notNull(title, "Title cannot be null"); @@ -40,6 +41,9 @@ public class CraftMerchantCustom extends CraftMerchant { @Override public void setTradingPlayer(EntityHuman entityhuman) { this.tradingPlayer = entityhuman; + if (entityhuman != null) { + this.tradingWorld = entityhuman.world; + } } @Override @@ -68,7 +72,7 @@ public class CraftMerchantCustom extends CraftMerchant { @Override public World getWorld() { - return null; + return this.tradingWorld; } @Override