diff --git a/src/main/java/org/maxgamer/quickshop/Command/QS.java b/src/main/java/org/maxgamer/quickshop/Command/QS.java index 69aa35937..9c0b2faf9 100644 --- a/src/main/java/org/maxgamer/quickshop/Command/QS.java +++ b/src/main/java/org/maxgamer/quickshop/Command/QS.java @@ -634,7 +634,7 @@ public class QS implements CommandExecutor { } for (Shop shop : pendingRemoval) - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.DELETE })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.DELETE)); MsgUtil.clean(); sender.sendMessage(MsgUtil.getMessage("command.cleaned", "" + i)); diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java index e870b55f8..b2d6f8e46 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/BlockListener.java @@ -164,7 +164,7 @@ public class BlockListener implements Listener { plugin.getLogger().warning("[Exploit Alert] a Entity tried to break the shop of " + shop); Util.sendMessageToOps(ChatColor.RED + "[QuickShop][Exploit alert] A Entity tried to break the shop of " + shop); } else { - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.DELETE })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.DELETE)); } } } @@ -219,7 +219,7 @@ public class BlockListener implements Listener { plugin.getLogger().warning("[Exploit Alert] a EntityExplode tried to break the shop of " + shop); Util.sendMessageToOps(ChatColor.RED + "[QuickShop][Exploit alert] A EntityExplode tried to break the shop of " + shop); } else { - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.DELETE })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.DELETE)); } } } @@ -236,7 +236,7 @@ public class BlockListener implements Listener { plugin.getLogger().warning("[Exploit Alert] a BlockExplode tried to break the shop of " + shop); Util.sendMessageToOps(ChatColor.RED + "[QuickShop][Exploit alert] A BlockExplode tried to break the shop of " + shop); } else { - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.DELETE })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.DELETE)); } } } diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/ChunkListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/ChunkListener.java index 5fd9b969d..445354dd6 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/ChunkListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/ChunkListener.java @@ -38,7 +38,7 @@ public class ChunkListener implements Listener { for (Shop shop : inChunk.values()) { Util.debugLog("Add shop at " + shop.getLocation().toString() + " to waiting load queue."); plugin.getQueuedShopManager() - .add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.LOAD, QueueAction.SETSIGNTEXT })); + .add(new QueueShopObject(shop, QueueAction.LOAD, QueueAction.SETSIGNTEXT)); } } @@ -52,7 +52,7 @@ public class ChunkListener implements Listener { if (inChunk == null) return; for (Shop shop : inChunk.values()) { - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.UNLOAD })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.UNLOAD)); } } } \ No newline at end of file diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/WorldListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/WorldListener.java index 526e638a8..afc1b0f2a 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/WorldListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/WorldListener.java @@ -61,7 +61,7 @@ public class WorldListener implements Listener { if (inChunk == null) continue; for (Shop shop : inChunk.values()) { - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.LOAD })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.LOAD)); } } } @@ -79,7 +79,7 @@ public class WorldListener implements Listener { if (inChunk == null) continue; for (Shop shop : inChunk.values()) { - plugin.getQueuedShopManager().add(new QueueShopObject(shop, new QueueAction[]{ QueueAction.UNLOAD })); + plugin.getQueuedShopManager().add(new QueueShopObject(shop, QueueAction.UNLOAD)); } } } diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index c67c65ac1..1c657965e 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -9,7 +9,6 @@ import java.util.Map.Entry; import com.onarandombox.MultiverseCore.MultiverseCore; import lombok.*; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.configuration.ConfigurationSection; @@ -286,13 +285,14 @@ public class QuickShop extends JavaPlugin { 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."); - } - } - cShop.getDisplayItem().remove(); + // 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)); } } } diff --git a/src/main/java/org/maxgamer/quickshop/Shop/QueueAction.java b/src/main/java/org/maxgamer/quickshop/Shop/QueueAction.java index 3d27df63b..6f695024d 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, CHECKDISPLAYMOVED, SETSIGNTEXT, DELETE, CLICK + LOAD, UNLOAD, UPDATE, SETSIGNTEXT, DELETE, CLICK, REMOVEDISPLAYITEM } diff --git a/src/main/java/org/maxgamer/quickshop/Shop/QueueShopObject.java b/src/main/java/org/maxgamer/quickshop/Shop/QueueShopObject.java index 4f11d7d9d..57bbc1e38 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/QueueShopObject.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/QueueShopObject.java @@ -4,7 +4,6 @@ import lombok.*; @Getter @Setter -@AllArgsConstructor public class QueueShopObject { /** * The shop you want to do actions @@ -14,4 +13,10 @@ public class QueueShopObject { * The actions you want to do */ private QueueAction[] action; + + public QueueShopObject(Shop shop, QueueAction... action) { + this.shop = shop; + this.action = action; + } + } diff --git a/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java b/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java index dd48ac7c7..d672a29d3 100644 --- a/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/Shop/QueuedShopManager.java @@ -51,8 +51,8 @@ public class QueuedShopManager { case SETSIGNTEXT: queueShopObject.getShop().setSignText(); break; - case CHECKDISPLAYMOVED: - queueShopObject.getShop().checkDisplay(); + case REMOVEDISPLAYITEM: + ((ContainerShop) queueShopObject.getShop()).getDisplayItem().remove(); break; case DELETE: queueShopObject.getShop().delete();