SPIGOT-4725: Virtual Merchant GUI crashes server

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-04-24 10:10:41 +10:00
parent 950a1e4bb8
commit db7e2f9830

View File

@@ -31,6 +31,7 @@ public class CraftMerchantCustom extends CraftMerchant {
private final IChatBaseComponent title; private final IChatBaseComponent title;
private final MerchantRecipeList trades = new MerchantRecipeList(); private final MerchantRecipeList trades = new MerchantRecipeList();
private EntityHuman tradingPlayer; private EntityHuman tradingPlayer;
private World tradingWorld;
public MinecraftMerchant(String title) { public MinecraftMerchant(String title) {
Validate.notNull(title, "Title cannot be null"); Validate.notNull(title, "Title cannot be null");
@@ -40,6 +41,9 @@ public class CraftMerchantCustom extends CraftMerchant {
@Override @Override
public void setTradingPlayer(EntityHuman entityhuman) { public void setTradingPlayer(EntityHuman entityhuman) {
this.tradingPlayer = entityhuman; this.tradingPlayer = entityhuman;
if (entityhuman != null) {
this.tradingWorld = entityhuman.world;
}
} }
@Override @Override
@@ -68,7 +72,7 @@ public class CraftMerchantCustom extends CraftMerchant {
@Override @Override
public World getWorld() { public World getWorld() {
return null; return this.tradingWorld;
} }
@Override @Override