rearranged notify methods

This commit is contained in:
Samuel Pizette
2022-12-04 19:17:36 -05:00
parent fd8c67fa66
commit 74c428b90d

View File

@@ -130,10 +130,22 @@ public interface CommandBase {
default @NotNull <T> T notifyFalse(@NotNull T obj,
@NotNull Predicate<T> 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.
*