Queue the display moved checking

Former-commit-id: de29db7da0448e61436fda65400ace67c7558274 [formerly 356e2ef977078916a588c32cd424959dcc8d862d]
Former-commit-id: 139dea203e44144753db42b501cd3e98fd75d28e
This commit is contained in:
Ghost_chu committed 2019-05-30 20:47:35 +08:00
1 parent d6f26276d7
commit dfd4e435b4
4 files changed
+24 -16

No files matched your search

@@ -280,21 +280,7 @@ public class QuickShop extends JavaPlugin {
Iterator<Shop> 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);
@@ -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));
}
}
}
}
@@ -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
}
@@ -60,6 +60,9 @@ public class QueuedShopManager {
case CLICK:
queueShopObject.getShop().onClick();
break;
case CHECKDISPLAYITEM:
DisplayItem.checkDisplayMove(queueShopObject.getShop());
break;
}
}