From 58bf438108f918ee33390bfc58a31fb54e25944f Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Fri, 10 Jan 2020 23:05:01 +0800 Subject: [PATCH] Don't keep display, it may cause performance issue Former-commit-id: 2dc3c7bcfea92381b547fa7448e35855fedeef64 --- .../Listeners/DisplayProtectionListener.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java index 2cd679f13..66e69b8ed 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java @@ -78,6 +78,9 @@ public class DisplayProtectionListener implements Listener { return; } event.setCancelled(true); + if(shop.getDisplay() != null){ + shop.getDisplay().remove(); + } sendAlert("[DisplayGuard] Liuqid " + targetBlock.getLocation() + " trying flow to top of shop, QuickShop already cancel it."); } @@ -110,6 +113,9 @@ public class DisplayProtectionListener implements Listener { if (shop != null) { event.setCancelled(true); sendAlert("[DisplayGuard] Piston " + event.getBlock().getLocation() + " trying push somethings on the shop top, QuickShop already cancel it."); + if(shop.getDisplay() != null){ + shop.getDisplay().remove(); + } return; } for (Block oBlock : event.getBlocks()) { @@ -119,6 +125,9 @@ public class DisplayProtectionListener implements Listener { if (shop != null) { event.setCancelled(true); sendAlert("[DisplayGuard] Piston " + event.getBlock().getLocation() + " trying push somethings on the shop top, QuickShop already cancel it."); + if(shop.getDisplay() != null){ + shop.getDisplay().remove(); + } return; } } @@ -138,6 +147,9 @@ public class DisplayProtectionListener implements Listener { if (shop != null) { event.setCancelled(true); sendAlert("[DisplayGuard] Piston " + event.getBlock().getLocation() + " trying pull somethings on the shop top, QuickShop already cancel it."); + if(shop.getDisplay() != null){ + shop.getDisplay().remove(); + } return; } for (Block oBlock : event.getBlocks()) { @@ -147,6 +159,9 @@ public class DisplayProtectionListener implements Listener { if (shop != null) { event.setCancelled(true); sendAlert("[DisplayGuard] Piston " + event.getBlock().getLocation() + " trying push somethings on the shop top, QuickShop already cancel it."); + if(shop.getDisplay() != null){ + shop.getDisplay().remove(); + } return; } } @@ -186,6 +201,7 @@ public class DisplayProtectionListener implements Listener { sendAlert("[DisplayGuard] Block " + event.getBlock().getLocation() + " trying burn with DisplayItem."); Util.inventoryCheck(furnace1.getInventory()); + } } } @@ -534,6 +550,7 @@ public class DisplayProtectionListener implements Listener { .getName() + " trying hook item use Fishing Rod, QuickShop already removed it."); Util.inventoryCheck(event.getPlayer().getInventory()); + } @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)