diff --git a/src/main/java/org/maxgamer/quickshop/eventmanager/QSEventManager.java b/src/main/java/org/maxgamer/quickshop/eventmanager/QSEventManager.java index 8a1f24bce..0c9598944 100644 --- a/src/main/java/org/maxgamer/quickshop/eventmanager/QSEventManager.java +++ b/src/main/java/org/maxgamer/quickshop/eventmanager/QSEventManager.java @@ -62,7 +62,7 @@ public class QSEventManager implements QuickEventManager, Listener { this.rescan(); } - private void rescan() { + private synchronized void rescan() { this.ignoredListener.clear(); plugin .getConfig() diff --git a/src/main/java/org/maxgamer/quickshop/eventmanager/QuickEventManager.java b/src/main/java/org/maxgamer/quickshop/eventmanager/QuickEventManager.java index e6d6d59a9..5e5ea7fb8 100644 --- a/src/main/java/org/maxgamer/quickshop/eventmanager/QuickEventManager.java +++ b/src/main/java/org/maxgamer/quickshop/eventmanager/QuickEventManager.java @@ -21,6 +21,16 @@ package org.maxgamer.quickshop.eventmanager; import org.bukkit.event.Event; +/** + * QuickEventManager allow user switch between bukkit and quickshop. + * QuickShop's EventManager can filter the Plugin listeners and skip it when calling events + */ public interface QuickEventManager { + /** + * Calling an event use QuickShopEventManager + * + * @param event The event + * @throws IllegalStateException Just like bukkit + */ void callEvent(Event event) throws IllegalStateException; } diff --git a/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java b/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java index ddae3b9eb..195ea73d0 100644 --- a/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java +++ b/src/main/java/org/maxgamer/quickshop/shop/ShopManager.java @@ -866,7 +866,6 @@ public class ShopManager { Util.debugLog("Player " + p + " no permission to create stacks shop, forcing creating single item shop"); info.getItem().setAmount(1); } - Util.debugLog("actionCreate"); // Checking the shop can be created Util.debugLog("Calling for protection check..."); @@ -893,8 +892,7 @@ public class ShopManager { MsgUtil.sendMessage(p, MsgUtil.getMessage("chest-was-removed", p)); return; } - if (info.getLocation().getBlock().getType() - == Material.ENDER_CHEST) { // FIXME: Need a better impl + if (info.getLocation().getBlock().getType() == Material.ENDER_CHEST) { // FIXME: Need a better impl if (!QuickShop.getPermissionManager().hasPermission(p, "quickshop.create.enderchest")) { return; } @@ -1322,15 +1320,14 @@ public class ShopManager { Bukkit.getPluginManager().callEvent(se); } - private boolean shopIsNotValid(@NotNull UUID uuid, @NotNull Info info, @NotNull Shop shop) { + public boolean shopIsNotValid(@NotNull UUID uuid, @NotNull Info info, @NotNull Shop shop) { Player player = Bukkit.getPlayer(uuid); return shopIsNotValid(player, info, shop); } private boolean shopIsNotValid(@Nullable Player p, @NotNull Info info, @NotNull Shop shop) { if (plugin.getEconomy() == null) { - MsgUtil.sendMessage( - p, "Error: Economy system not loaded, type /qs main command to get details."); + MsgUtil.sendMessage(p, "Error: Economy system not loaded, type /qs main command to get details."); return true; } if (!Util.canBeShop(info.getLocation().getBlock())) {