Allow @PluginName syntax

This commit is contained in:
Ghost_chu committed 2021-01-09 17:53:30 +08:00
1 parent aa8989132e
commit a10df0c5e1
1 file changed
+5 -2
@@ -114,7 +114,7 @@ public class QSEventManager implements QuickEventManager, Listener {
continue;
}
Class<?> regClass = registration.getListener().getClass();
if (this.ignoredListener.stream().anyMatch(listenerContainer -> listenerContainer.matches(regClass))) {
if (this.ignoredListener.stream().anyMatch(listenerContainer -> listenerContainer.matches(regClass, registration.getPlugin()))) {
continue;
}
@@ -157,10 +157,13 @@ class ListenerContainer {
@NotNull
private final String clazzName;
public boolean matches(Class<?> matching) {
public boolean matches(@NotNull Class<?> matching, @NotNull Plugin plugin) {
if (clazz != null) {
return matching.equals(clazz);
}
if (clazzName.startsWith("@")) {
return clazzName.equalsIgnoreCase("@" + plugin.getName());
}
String name = matching.getName();
if (name.equalsIgnoreCase(clazzName)) {
return true;