GenericListener: Don't handle events that can't be handled.

For some reason this is needed.
This commit is contained in:
asofold 2012-11-08 19:47:37 +01:00
parent e17cb6f5dd
commit ff5db38d0e

View File

@ -88,6 +88,10 @@ public class GenericListener<E extends Event> implements Listener, EventExecutor
@Override
public final void execute(final Listener listener, final Event event){
if (!clazz.isAssignableFrom(event.getClass())){
// Strange but true.
return;
}
// TODO: profiling option !
final Cancellable cancellable = isCancellable ? (Cancellable) event : null;