customized failed rules behaviour
This commit is contained in:
1 parent
0c5f828b3b
commit
7421e56670
2 files changed
+5
-1
No files matched your search
@@ -163,7 +163,7 @@ public final class ParsedRule<T> implements Comparable<ParsedRule> {
|
||||
{
|
||||
if (source != null)
|
||||
{
|
||||
Messenger.m(source, "r Wrong value for " + name + ": " + stringValue);
|
||||
validator.notifyFailure(source, this, stringValue);
|
||||
if (validator.description() != null)
|
||||
Messenger.m(source, "r " + validator.description());
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ public abstract class Validator<T>
|
||||
*/
|
||||
public abstract T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string);
|
||||
public String description() {return null;}
|
||||
public void notifyFailure(ServerCommandSource source, ParsedRule<T> currentRule, String providedValue)
|
||||
{
|
||||
Messenger.m(source, "r Wrong value for " + currentRule.name + ": " + providedValue);
|
||||
}
|
||||
|
||||
public static class _COMMAND<T> extends Validator<T>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user