From 9d580650689093c93fa5fc753ed59ec35c1bd80d Mon Sep 17 00:00:00 2001 From: sandtechnology <20417547+sandtechnology@users.noreply.github.com> Date: Fri, 20 Mar 2020 23:05:34 +0800 Subject: [PATCH] Remove duplicate remove code Former-commit-id: 4df1c4e36204ce46b8e472e956c0ba8123cd30a7 --- src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java | 4 ---- .../java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java index 9587b1613..84a4b5090 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java @@ -335,10 +335,6 @@ public class ContainerShop implements Shop { if (isLoaded) { this.onUnload(); } - // Delete the display item - if (this.getDisplayItem() != null) { - this.getDisplayItem().remove(); - } // Delete the signs around it for (Sign s : this.getSigns()) { s.getBlock().setType(Material.AIR); diff --git a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java index 446eca06a..fb8669f6f 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java @@ -236,7 +236,9 @@ public class VirtualDisplayItem extends DisplayItem { private void unload() { packetSenders.clear(); - protocolManager.removePacketListener(packetAdapter); + if(packetAdapter!=null) { + protocolManager.removePacketListener(packetAdapter); + } if (asyncSendingTask != null && !asyncSendingTask.isCancelled()) { asyncSendingTask.cancel(); }