Merge branch 'master' into 1.16

This commit is contained in:
gnembon committed 2020-05-13 10:37:27 -03:00
commit 903fe1e31a
5 files changed
+25 -20

No files matched your search

+11 -11
View File
@@ -17,17 +17,6 @@ public abstract class Validator<T>
public abstract T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string);
public String description() {return null;}
public static class POSITIVE_NUMBER<T extends Number> extends Validator<T>
{
@Override
public T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string)
{
return newValue.doubleValue() > 0 ? newValue : null;
}
@Override
public String description() { return "Must be a positive number"; }
}
public static class _COMMAND<T> extends Validator<T>
{
@Override
@@ -119,4 +108,15 @@ public abstract class Validator<T>
@Override
public String description() { return "Must be a positive number";}
}
public static class PROBABILITY <T extends Number> extends Validator<T>
{
@Override
public T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string)
{
return (newValue.doubleValue() >= 0 && newValue.doubleValue() <= 1 )? newValue : null;
}
@Override
public String description() { return "Must be between 0 and 1";}
}
}