From 454a6bcd9801cc0561e4659c0fe8bc1f37a5b14e Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Tue, 31 Jul 2018 14:31:48 +0800 Subject: [PATCH] Trying fix display item can be pickup by hopper Former-commit-id: 50ead2f2f8628d0c998daf0f950a26e75083322f --- .../java/org/maxgamer/quickshop/Listeners/BlockListener.java | 4 ---- .../quickshop/Listeners/DisplayProtectionListener.java | 2 +- src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java | 4 +++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java index c5b0ccee5..c9b017b28 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java @@ -127,10 +127,6 @@ public class BlockListener implements Listener { return; } event.setCancelled(true); - Block removeHopper=(Block)h; - removeHopper.setType(Material.AIR); - plugin.getLogger().warning("[Exploit Alert] a Hopper tried to move the item of "+shop); - Util.sendMessageToOps(ChatColor.RED+"[QuickShop][Exploit alert] A Hopper tried to move the item of "+shop); } } } diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java index 5db14475c..38c4a9266 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/DisplayProtectionListener.java @@ -67,6 +67,6 @@ public class DisplayProtectionListener implements Listener { } boolean itemStackCheck(ItemStack is) { - return is!=null && is.getItemMeta()!=null && is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().startsWith(ChatColor.RED + "QuickShop "); + return is!=null & is.getItemMeta().hasDisplayName() && is.getItemMeta().getDisplayName().startsWith(ChatColor.RED + "QuickShop "); } } diff --git a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java index e035c78d6..4f51b5b3a 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java @@ -1,5 +1,7 @@ package org.maxgamer.quickshop.Shop; +import java.util.UUID; + import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.Location; @@ -66,7 +68,7 @@ public class DisplayItem { } public void safeGuard(Item item) { item.setPickupDelay(Integer.MAX_VALUE); - item.setCustomName(ChatColor.RED + "QuickShop " + Util.getName(iStack) + " " + nextId++); + item.setCustomName(ChatColor.RED + "QuickShop "+UUID.randomUUID().toString().replaceAll("-", "")); } /** * Removes all items floating ontop of the chest that aren't the display