Package redempt.redlib.commandmanager
Class Constraint<T>
java.lang.Object
redempt.redlib.commandmanager.Constraint<T>
- Type Parameters:
T
- The type this Constraint checks on
Represents a condition which can be tested on command arguments, and can dynamically generate error messages
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
static <T> Constraint<T>
of
(String error, BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraintstatic <T> Constraint<T>
of
(BiFunction<org.bukkit.command.CommandSender, T, String> error, BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraintstatic <T> Constraint<T>
of
(BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraintstatic <T> Constraint<T>
of
(Function<T, String> error, BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraintboolean
-
Method Details
-
of
public static <T> Constraint<T> of(String error, BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraint- Type Parameters:
T
- The type of the constraint- Parameters:
error
- The error message to show when the constraint failscondition
- A predicate to perform the constraint check on a converted argument- Returns:
- A constructed Constraint
-
of
Create a Constraint- Type Parameters:
T
- The type of the constraint- Parameters:
condition
- A predicate to perform the constraint check on a converted argument- Returns:
- A constructed Constraint
-
of
public static <T> Constraint<T> of(Function<T, String> error, BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraint- Type Parameters:
T
- The type of the constraint- Parameters:
error
- A function to generate the error to be shown on constraint failcondition
- A predicate to perform the constraint check on a converted argument- Returns:
- A constructed Constraint
-
of
public static <T> Constraint<T> of(BiFunction<org.bukkit.command.CommandSender, T, String> error, BiPredicate<org.bukkit.command.CommandSender, T> condition) Create a Constraint- Type Parameters:
T
- The type of the constraint- Parameters:
error
- A function to generate the error to be shown on constraint failcondition
- A predicate to perform the constraint check on a converted argument- Returns:
- A constructed Constraint
-
setName
-
getName
-
test
-
getError
-