diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 1c657965e..55879a3de 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -280,21 +280,7 @@ public class QuickShop extends JavaPlugin { Iterator it = getShopManager().getShopIterator(); while (it.hasNext()) { Shop shop = it.next(); - if (shop instanceof ContainerShop) { - ContainerShop cShop = (ContainerShop) shop; - if (cShop.checkDisplayMoved()) { - log("Display item for " + shop - + " is not on the correct location and has been removed. Probably someone is trying to cheat."); - // for (Player player : getServer().getOnlinePlayers()) { - // if (player.hasPermission("quickshop.alerts")) { - // player.sendMessage(ChatColor.RED + "[QuickShop] Display item for " + shop - // + " is not on the correct location and has been removed. Probably someone is trying to cheat."); - // } - // } - Util.sendMessageToOps("[QuickShop] Display item for " + shop + " is not on the correct location and has been removed. Probably someone is trying to cheat."); - getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.REMOVEDISPLAYITEM)); - } - } + getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.CHECKDISPLAYITEM)); } } }.runTaskTimer(this, 1L, displayItemCheckTicks); diff --git a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java index a6937c921..0156aa8a9 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/DisplayItem.java @@ -13,6 +13,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.util.Vector; import org.maxgamer.quickshop.QuickShop; +import org.maxgamer.quickshop.Util.Util; //import org.maxgamer.quickshop.Util.NMS; /** @@ -178,4 +179,22 @@ public class DisplayItem { public Item getItem() { return this.item; } + + public static void checkDisplayMove(Shop shop) { + if (shop instanceof ContainerShop) { + ContainerShop cShop = (ContainerShop) shop; + if (cShop.checkDisplayMoved()) { + //log("Display item for " + shop + // + " is not on the correct location and has been removed. Probably someone is trying to cheat."); + // for (Player player : getServer().getOnlinePlayers()) { + // if (player.hasPermission("quickshop.alerts")) { + // player.sendMessage(ChatColor.RED + "[QuickShop] Display item for " + shop + // + " is not on the correct location and has been removed. Probably someone is trying to cheat."); + // } + // } + Util.sendMessageToOps("[QuickShop] Display item for " + shop + " is not on the correct location and has been removed. Probably someone is trying to cheat."); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.REMOVEDISPLAYITEM)); + } + } + } } \ No newline at end of file diff --git a/src/main/java/org/maxgamer/quickshop/Shop/QueueAction.java b/src/main/java/org/maxgamer/quickshop/Shop/QueueAction.java index 6f695024d..1bd9cb807 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/QueueAction.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/QueueAction.java @@ -1,5 +1,5 @@ package org.maxgamer.quickshop.Shop; public enum QueueAction { - LOAD, UNLOAD, UPDATE, SETSIGNTEXT, DELETE, CLICK, REMOVEDISPLAYITEM + LOAD, UNLOAD, UPDATE, SETSIGNTEXT, DELETE, CLICK, REMOVEDISPLAYITEM, CHECKDISPLAYITEM } diff --git a/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java index d672a29d3..2fd34d119 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java @@ -60,6 +60,9 @@ public class QueuedShopManager { case CLICK: queueShopObject.getShop().onClick(); break; + case CHECKDISPLAYITEM: + DisplayItem.checkDisplayMove(queueShopObject.getShop()); + break; } }