From 239af3a6181a808bbf7d9a6f32e9bb70ce981d07 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Thu, 6 Jun 2019 16:48:44 +0800 Subject: [PATCH] Check before load/unload Former-commit-id: 774c929b5deb80a3e487ef8bd625c0de53d8f3b0 [formerly bf106ec8fedeeecbcb789db31a43abda59bd2e4f] Former-commit-id: 57ba1a0e8c3f1d168292dbbe6f5ede45ad410726 --- .../org/maxgamer/quickshop/Shop/ContainerShop.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java index abc19d508..7ffdc37f2 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java @@ -635,7 +635,8 @@ public class ContainerShop implements Shop { */ public void delete(boolean fromMemory) { // Unload the shop - this.onUnload(); + if (isLoaded) + this.onUnload(); // Delete the display item if (this.getDisplayItem() != null) { this.getDisplayItem().remove(); @@ -740,6 +741,10 @@ public class ContainerShop implements Shop { * Unload ContainerShop. */ public void onUnload() { + if (!this.isLoaded) { + Util.debugLog("Dupe unload request, cancelled."); + return; + } if (this.getDisplayItem() != null) { this.getDisplayItem().remove(); this.displayItem = null; @@ -751,6 +756,10 @@ public class ContainerShop implements Shop { * Load ContainerShop. */ public void onLoad() { + if (this.isLoaded) { + Util.debugLog("Dupe load request, cancelled."); + return; + } checkDisplay(); //Clear the chest?