Fix protection check bugs.

Fix #179
Fix #177
Fix #176


Former-commit-id: 1a547b2ca85b3290c3a3808f35e15fdd34360983 [formerly 01e4707eacec53e88b572b673aa7af947c40611e]
Former-commit-id: c7f807fafa1db8d8e5874a88f4563bba0922e784
This commit is contained in:
Ghost_chu committed 2019-09-12 19:36:01 +08:00
1 parent c4f2bf0d04
commit 740e04ee1c
1 file changed
+10 -5
@@ -79,13 +79,19 @@ public class QSEventManager {
Util.debugLog("Container is null, skipping...");
continue;
}
for (PluginEventFilterContainer container : containers) {
if (container.getListener().equals(registration.getListener().getClass().getName())) {
if (container.getEvent().equals(event.getClass().getName())) {
boolean cancelPluginCalling = false;
for (PluginEventFilterContainer disabledContainer : containers) {
if (disabledContainer.getListener().equals(registration.getListener().getClass().getName())) {
if (disabledContainer.getEvent().equals(event.getClass().getName())) {
Util.debugLog("Skipping event " + event.getClass().getName() + " calling for plugin " + registration.getPlugin().getName() + "'s listener " + registration.getListener().getClass().getName());
continue;
cancelPluginCalling = true;
break;
}
}
}
if(cancelPluginCalling) {
continue; //Skip this listener calling+
}
Util.debugLog("Calling event " + event.getClass().getName() + " calling for plugin " + registration.getPlugin().getName() + "'s listener " + registration.getListener().getClass().getName());
try {
registration.callEvent(event);
@@ -111,7 +117,6 @@ public class QSEventManager {
plugin.getLogger().info("A plugin throw an error when checking protection permission, you should check them, DO NOT REPORT THIS TO QUICKSHOP.");
}
}
}
return null;
}
}