code: public <E extends Listener> void preventCascade(Class<E> listenerClass) {
          if (listenerClass == null) {
              throw new IllegalArgumentException("listenerClass is null");
          } else if (this.eventStack != null) {
              // this event is currently being dispatched, so adding a prevented
              // class has no effect.
              LOGGER.warn("'preventCascade' has been called on {} for listener class {} "
                      + "while the event was being dispatched. preventCascade must be "
                      + "called before dispatching the event.",
                      this.getClass().getSimpleName(),
                      getListenerClass().getSimpleName());
              return;
          } else if (this.prevent == null) {
              this.prevent = new HashSet<>();
          }
          this.prevent.add(listenerClass);
      }
docs: Prevents to dispatch events to the given listener class while this event
  is being dispatched. This is only supported when dispatching this event
  with an EventProvider which supports the {@link EventStack}.
  
  <p>
  Note: this method has to be called before this event is being dispatched.
  If called during dispatch, it will have no effect.
  </p>
  
  @param <E> Type of the listener class.
  @param listenerClass The listener class to prevent being notified.
  @see #preventCascade()