Add option to turn off permission checking event manager and default turn off

Former-commit-id: df299754b23d6aa717c28ebffc70aa3f60669c3d [formerly 82b3bb0a9f1a4826278c1437edb7179538f9be9d]
Former-commit-id: dbf8d44b9bd6d8808505e4fada203e0f7b07babb
This commit is contained in:
Ghost_chu committed 2019-09-12 19:30:28 +08:00
1 parent 4cc6abb0d9
commit c0a75026b1
4 files changed
+14 -5

No files matched your search

@@ -902,7 +902,11 @@ public class QuickShop extends JavaPlugin {
getConfig().set("config-version", 46);
selectedVersion = 46;
}
if (selectedVersion == 46) {
getConfig().set("shop.use-protection-checking-filter", false);
getConfig().set("config-version", 47);
selectedVersion = 47;
}
saveConfig();
reloadConfig();
File file = new File(getDataFolder(), "example.config.yml");
@@ -55,7 +55,12 @@ public class PermissionChecker {
//Bukkit.getPluginManager().callEvent(beMainHand);
beMainHand.setDropItems(false);
beMainHand.setExpToDrop(-1);
Plugin cancelPlugin = plugin.getQsEventManager().fireEvent(beMainHand);
Plugin cancelPlugin = null;
if(plugin.getConfig().getBoolean("shop.use-protection-checking-filter")){
cancelPlugin = plugin.getQsEventManager().fireEvent(beMainHand);
}else{
Bukkit.getPluginManager().callEvent(beMainHand);
}
//Use our custom event caller.
ListenerHelper.enableEvent(beMainHand.getClass());
//Call for event for protection check end
@@ -69,8 +74,6 @@ public class PermissionChecker {
// }
if(cancelPlugin != null) {
Util.debugLog("Plugin " + cancelPlugin.getName() + " cancelled this build create action.");
}else{
Util.debugLog("Internal server error.");
}
}
@@ -76,6 +76,7 @@ public class QSEventManager {
}
Set<PluginEventFilterContainer> containers = containerSet.get(registration.getPlugin().getName());
if (containers == null) {
Util.debugLog("Container is null, skipping...");
continue;
}
for (PluginEventFilterContainer container : containers) {
+2 -1
View File
@@ -1,7 +1,7 @@
#This is example config, don't direct modify this file, all changes will revert when you reload the plugin.
#Do not touch if you not clear know about this
config-version: 46
config-version: 47
#Select the language you want to use, (e.g de), use only supported language codes from the list below.
#If you use a not exist/not support language, plugin will move to use en_US to keep everything working.
@@ -231,6 +231,7 @@ shop:
#Protection advanced event calling filter
#Advance users only.
use-protection-checking-filter: false
protection-checking-filter: []
# - PLUGIN##LISTENER##EVENT
#Example: - QuickShop##org.maxgamer.Listeners.BlockListener##org.bukkit.event.block.BlockPlaceEvent