From 84e336f4bf68849932962414c0cdb24276c3af66 Mon Sep 17 00:00:00 2001 From: sandtechnology <20417547+sandtechnology@users.noreply.github.com> Date: Sat, 29 Feb 2020 11:12:34 +0800 Subject: [PATCH] Remove useless code Former-commit-id: ef4e7e9473a0129dc70e231955703bc0d8d78a77 --- .../java/org/maxgamer/quickshop/Shop/ContainerShop.java | 7 ------- src/main/java/org/maxgamer/quickshop/Shop/Shop.java | 6 ------ .../org/maxgamer/quickshop/Shop/VirtualDisplayItem.java | 7 ------- 3 files changed, 20 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java index 9ea9b43293..e5a6e5c16a 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/ContainerShop.java @@ -68,7 +68,6 @@ public class ContainerShop implements Shop { private double price; private ShopType shopType; private boolean unlimited; - private boolean isDeleted; private ContainerShop(@NotNull ContainerShop s) { this.displayItem = s.displayItem; @@ -399,7 +398,6 @@ public void delete(boolean fromMemory) { if (isLoaded) { this.onUnload(); } - isDeleted=true; // Delete the display item if (this.getDisplayItem() != null) { this.getDisplayItem().remove(); @@ -877,11 +875,6 @@ public boolean isValid() { return Util.canBeShop(this.getLocation().getBlock()); } - @Override - public boolean isDeleted() { - return isDeleted; - } - @Override public @Nullable DisplayItem getDisplay() { return this.displayItem; diff --git a/src/main/java/org/maxgamer/quickshop/Shop/Shop.java b/src/main/java/org/maxgamer/quickshop/Shop/Shop.java index d352933693..592b9957e0 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/Shop.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/Shop.java @@ -303,12 +303,6 @@ public interface Shop { */ boolean isValid(); - /** - * Shop is deleted - * - * @return true if deleted - */ - boolean isDeleted(); /** * Get the shop display entity diff --git a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java index 6eb86a87db..7f23e3b511 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/VirtualDisplayItem.java @@ -49,7 +49,6 @@ public class VirtualDisplayItem extends DisplayItem { private static ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); private volatile boolean isDisplay; - private volatile boolean isLoaded; //counter for ensuring ID is unique private static final AtomicInteger counter = new AtomicInteger(0); //server main version (1_13_R2->13) @@ -92,11 +91,6 @@ public void onPacketSending(PacketEvent event) { //is really full chunk data boolean isFull = event.getPacket().getBooleans().read(0); - //if shop has deleted, unregister myself to ensure will be collected by GC - if (!shop.isDeleted()) { - unload(); - return; - } if (!shop.isLoaded() || !isDisplay || !isFull || !Util.isLoaded(shop.getLocation())) { return; } @@ -105,7 +99,6 @@ public void onPacketSending(PacketEvent event) { //chunk z int z = event.getPacket().getIntegers().read(1); - World world = shop.getLocation().getWorld(); Chunk chunk = shop.getLocation().getChunk(); if (world.getName().equals(event.getPlayer().getWorld().getName())