mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-24 17:39:52 -05:00
Queue the display removeing
Former-commit-id: 7f4bece045ea8931e513361aeaab9c5f69293a92 [formerly 949d73ed5986a3961303156b0d147e3245f90ab6] Former-commit-id: 0af5e94c052d1199dd0739d1d5e652b85ca890d5
This commit is contained in:
1 parent
ce83fc6798
commit
d6f26276d7
8 files changed
+25
-20
No files matched your search
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user