Annotate source in Validator with @Nullable

Using it without a check happens too many times
This commit is contained in:
altrisi committed 2023-01-20 14:41:41 +01:00
1 parent d9a4a62f7c
commit 58a68739c5
1 file changed
+3 -1
@@ -1,5 +1,7 @@
package carpet.api.settings;
import org.jetbrains.annotations.Nullable;
import carpet.utils.Messenger;
import net.minecraft.commands.CommandSourceStack;
@@ -35,7 +37,7 @@ public abstract class Validator<T>
* @return The new value to set the rule to instead, can return the {@code newValue} if the given value is correct.
* Returns {@code null} if the given value is not correct.
*/
public abstract T validate(CommandSourceStack source, CarpetRule<T> changingRule, T newValue, String userInput);
public abstract T validate(@Nullable CommandSourceStack source, CarpetRule<T> changingRule, T newValue, String userInput);
/**
* @return A description of this {@link Validator}. It is used in the default {@link #notifyFailure(CommandSourceStack, CarpetRule, String)}