Add parseValue to BlockTrait.
import org.spongepowered.api.block.BlockTypes;
import java.util.Collection;
+import java.util.Optional;
import java.util.function.Predicate;
/**
Class<T> getValueClass();
/**
- * Gets the {@link Predicate} used to determine valid values for this
+ * Gets the {@link Predicate} used to determine valid values for this.
* {@link BlockTrait}. Any "value" that returns <code>true</code> when
* {@link Predicate#test(Object)} is called is valid. The
* {@link Predicate} is specific to this trait.
*/
Predicate<T> getPredicate();
+ /**
+ * Attempts to parse the provided value as a value dictated possible by this trait or {@link Optional#empty()} otherwise.
+ *
+ * @param value The value to parse
+ * @return The actual value
+ */
+ Optional<T> parseValue(String value);
}
