code: public static <S, T extends Event, U extends T> InputMapTemplate<S, U> consumeWhen(
              EventPattern<? super T, ? extends U> eventPattern,
              Predicate<? super S> condition,
              BiConsumer<? super S, ? super U> action) {
          return process(eventPattern, (s, u) -> {
              if(condition.test(s)) {
                  action.accept(s, u);
                  return Result.CONSUME;
              } else {
                  return Result.PROCEED;
              }
          });
      }
docs: If the given {@link EventPattern} matches the given event type and {@code condition} is true,
  consumes the event and does not attempt to match additional
  {@code InputMap}s (if they exist).