From 74c428b90daece69d23a2a7d2dce790ba8d70bb7 Mon Sep 17 00:00:00 2001 From: Samuel Pizette Date: Sun, 4 Dec 2022 19:17:36 -0500 Subject: [PATCH] rearranged notify methods --- .../willfp/eco/core/command/CommandBase.java | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java b/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java index 9e5a37bc..3ff21d91 100644 --- a/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java +++ b/eco-api/src/main/java/com/willfp/eco/core/command/CommandBase.java @@ -130,10 +130,22 @@ public interface CommandBase { default @NotNull T notifyFalse(@NotNull T obj, @NotNull Predicate predicate, @NotNull String key) throws NotificationException { - if(!predicate.test(obj)) { + notifyFalse(predicate.test(obj), key); + return obj; + } + + /** + * @param condition the condition, throws exception if false + * @param key value in the langYml + * @return Returns the condition given or throws an exception + * @throws NotificationException exception thrown when false + */ + default boolean notifyFalse(boolean condition, @NotNull String key) + throws NotificationException { + if(!condition) { throw new NotificationException(key); } - return obj; + return true; } /** @@ -158,21 +170,6 @@ public interface CommandBase { } - /** - * @param condition the condition, throws exception if false - * @param key value in the langYml - * @return Returns the condition given or throws an exception - * @throws NotificationException exception thrown when false - */ - default boolean notifyFalse(boolean condition, @NotNull String key) - throws NotificationException { - if(!condition) { - throw new NotificationException(key); - } - return true; - } - - /** * Get the plugin. *