From fa72743d9ca34fe6c9d303e97888e6e142e630bd Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sun, 1 Mar 2020 22:17:31 +0800 Subject: [PATCH] Do not check items if display turned off or is virtual displayitem Former-commit-id: 1205794c1f35bd41aca96fb79a9dabaf177c38f9 --- .../maxgamer/quickshop/Shop/DisplayItem.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java index 3db0e89e0..165a4f583 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java @@ -58,6 +58,14 @@ public abstract class DisplayItem { * @return Contains protect flag. */ public static boolean checkIsGuardItemStack(@Nullable ItemStack itemStack) { + + if (!plugin.isDisplay()) { + return false; + } + if (getNowUsing() == DisplayType.VIRTUALITEM) { + return false; + } + if (itemStack == null) { return false; } @@ -106,6 +114,13 @@ public abstract class DisplayItem { * @return Is target shop's display */ public static boolean checkIsTargetShopDisplay(@NotNull ItemStack itemStack, @NotNull Shop shop) { + if (!plugin.isDisplay()) { + return false; + } + if (getNowUsing() == DisplayType.VIRTUALITEM) { + return false; + } + if (!itemStack.hasItemMeta()) { return false; } @@ -238,7 +253,7 @@ public abstract class DisplayItem { * * @param entity Target entity */ - public abstract void safeGuard(Entity entity); + public abstract void safeGuard(@NotNull Entity entity); /** Spawn new Displays */ public abstract void spawn();