From 21cb3b266a67f8f14f6d68e260a793de2f2f9141 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 17 Aug 2022 18:35:59 +0200 Subject: [PATCH] Add AbstractValidator.Validator.set --- src/de/steamwar/command/AbstractValidator.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/de/steamwar/command/AbstractValidator.java b/src/de/steamwar/command/AbstractValidator.java index b0340e3..aab4876 100644 --- a/src/de/steamwar/command/AbstractValidator.java +++ b/src/de/steamwar/command/AbstractValidator.java @@ -50,7 +50,12 @@ public interface AbstractValidator { private boolean valid = true; public Validator map(Function mapper) { - return new Validator<>(mapper.apply(value), messageSender).and(ignore -> valid); + return new Validator<>(mapper.apply(value), messageSender).set(valid); + } + + public Validator set(boolean value) { + this.valid = value; + return this; } public Validator and(Predicate predicate) {