From 293a0499bdec34878b0fd5ce837edb3229fdf0c8 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Mon, 17 Jun 2019 21:34:03 +0800 Subject: [PATCH] All display feature now pass the test Former-commit-id: a9a5b5329443ac653b99140d1d13993023e4a8e2 [formerly 777acb8a27442a0a69369822d63147b92f319c58] Former-commit-id: d7636dd20f79991740916661b54f53ed2b5cacf1 --- .../maxgamer/quickshop/Shop/ContainerShop.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java index ef974ed85..38b9b205e 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java @@ -89,7 +89,8 @@ public class ContainerShop implements Shop { if (plugin.isDisplay()) { switch (DisplayItem.getNowUsing()) { case UNKNOWN: - Util.debugLog("Failed to create a ContainerShop displayItem, the type is unknown."); + Util.debugLog("Failed to create a ContainerShop displayItem, the type is unknown, fallback to RealDisplayItem"); + this.displayItem = new RealDisplayItem(this); break; case REALITEM: this.displayItem = new RealDisplayItem(this); @@ -98,8 +99,12 @@ public class ContainerShop implements Shop { this.displayItem = new ArmorStandDisplayItem(this); break; default: - Util.debugLog("Failed to create a ContainerShop displayItem, the type we didn't know."); + Util.debugLog("Warning: Failed to create a ContainerShop displayItem, the type we didn't know, fallback to RealDisplayItem"); + this.displayItem = new RealDisplayItem(this); + break; } + } else { + Util.debugLog("The display was disabled."); } @@ -707,7 +712,6 @@ public class ContainerShop implements Shop { } if (this.getDisplayItem() != null) { this.getDisplayItem().remove(); - this.displayItem = null; } this.isLoaded = false; ShopUnloadEvent shopUnloadEvent = new ShopUnloadEvent(this); @@ -812,6 +816,12 @@ public class ContainerShop implements Shop { Util.debugLog("Checking the display..."); if (!plugin.isDisplay()) return; + if (this.displayItem == null) { + Util.debugLog("Warning: DisplayItem is null, this shouldn't happend..."); + Util.debugLog("Call from: " + Thread.currentThread().getStackTrace()[2].getClassName() + "#" + Thread.currentThread() + .getStackTrace()[2].getMethodName() + "%" + Thread.currentThread().getStackTrace()[2].getLineNumber()); + return; + } if (!this.displayItem.isSpawned()) { /* Not spawned yet. */ Util.debugLog("Target item not spawned, spawning...");