rearranged notify methods
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user