if (!clazz.isAssignableFrom(event.getClass())){
// Strange but true.
return;
}
// TODO: profiling option !
final Cancellable cancellable = isCancellable ? (Cancellable) event : null;
final MethodEntry[] entries = this.entries;
for (int i = 0; i < entries.length ; i++){
final MethodEntry entry = entries[i];
try {
if (!isCancellable || !entry.ignoreCancelled || !cancellable.isCancelled()) entry.method.invoke(entry.listener, event);
} catch (Throwable t) {
// IllegalArgumentException IllegalAccessException InvocationTargetException
onError(entry, event, t);
}
}