From 2a18a719c437da2fbaf4e028324a7ef38afc7b74 Mon Sep 17 00:00:00 2001 From: Ghost_chu <2908803755@qq.com> Date: Sat, 2 Feb 2019 23:48:41 +0800 Subject: [PATCH] chat plugin compatibility Former-commit-id: ade0af095d331216a8eaf692656393689373eecf [formerly cb9f457e2dba059c08dc44d37180ff6d19eb69f5] Former-commit-id: c16207f320b9a43b5740a3a454b6da11ddc0d9d7 --- pom.xml | 2 +- .../org/maxgamer/quickshop/Listeners/ChatListener.java | 7 ++++++- src/main/java/org/maxgamer/quickshop/QuickShop.java | 6 ++++++ src/main/resources/config.yml | 4 +++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 89486320a..c40aa4122 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.maxgamer QuickShop - Reremake 1.3.5.2 + Reremake 1.3.5.3 diff --git a/src/main/java/org/maxgamer/quickshop/Listeners/ChatListener.java b/src/main/java/org/maxgamer/quickshop/Listeners/ChatListener.java index 58d891d37..e62ece113 100644 --- a/src/main/java/org/maxgamer/quickshop/Listeners/ChatListener.java +++ b/src/main/java/org/maxgamer/quickshop/Listeners/ChatListener.java @@ -5,6 +5,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.AsyncPlayerChatEvent; import org.maxgamer.quickshop.QuickShop; +import org.maxgamer.quickshop.Util.Util; /** * @@ -17,8 +18,12 @@ public class ChatListener implements Listener { public ChatListener(QuickShop plugin) { this.plugin = plugin; } - @EventHandler(priority = EventPriority.LOWEST,ignoreCancelled=true) + @EventHandler(priority = EventPriority.LOWEST) public void onChat(AsyncPlayerChatEvent e) { + if(e.isCancelled()&&plugin.getConfig().getBoolean("shop.ignore-cancel-chat-event")) { + Util.debugLog("Ignorr chat event (cancel by other plugin.)"); + return; + } if (!plugin.getShopManager().getActions().containsKey(e.getPlayer().getUniqueId())) { plugin.log(plugin.getShopManager().getActions().toString()); return; diff --git a/src/main/java/org/maxgamer/quickshop/QuickShop.java b/src/main/java/org/maxgamer/quickshop/QuickShop.java index 8ddd3c9db..e580ba865 100644 --- a/src/main/java/org/maxgamer/quickshop/QuickShop.java +++ b/src/main/java/org/maxgamer/quickshop/QuickShop.java @@ -746,6 +746,12 @@ public class QuickShop extends JavaPlugin { saveConfig(); reloadConfig(); } + if (selectedVersion == 16) { + getConfig().set("config-version", 16); + selectedVersion = 17; + saveConfig(); + reloadConfig(); + } } /** Reloads QuickShops config */ diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 59677cd52..49ce71a94 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,7 +1,7 @@ #Default config: https://github.com/KaiKikuchi/QuickShop/blob/master/src/main/resources/config.yml #Do not touch if you not clear know about this -config-version: 16 +config-version: 17 #Do not touch if you not know what is this dev-mode: false @@ -119,6 +119,8 @@ shop: #Allow auto fetch player shop, if you disable it ,Player need use /qs fetchmessage to fetch history shop messages. (Disable it may cause database size lost control.) auto-fetch-shop-messages: true + #Ignore cancel chat event, maybe can improve compatibility with other chat plugin. + ignore-cancel-chat-event: false #List of items to disallow selling of. Anyone with quickshop.bypass. can bypass it