Interface EventValue.Builder<E extends org.bukkit.event.Event,V>
- Type Parameters:
E- the event typeV- the value type
- Enclosing interface:
EventValue<E extends org.bukkit.event.Event,V>
public static interface EventValue.Builder<E extends org.bukkit.event.Event,V>
A builder for creating
EventValue instances.-
Method Summary
Modifier and TypeMethodDescriptionEventValue<E, V> build()Builds the event value.eventValidator(Function<Class<?>, EventValue.Validation> eventValidator) Sets an event-type validator that must accept the event class for this value to be valid.excludedErrorMessage(String excludedErrorMessage) Sets an error message to be shown if this event value is selected for an excluded event.default EventValue.Builder<E, V> Excludes a specific event subclass from using this event value.Excludes specific event subclasses from using this event value.default EventValue.Builder<E, V> Excludes specific event subclasses from using this event value.default EventValue.Builder<E, V> Excludes specific event subclasses from using this event value.Sets the converter used to obtain the value from the event.inputValidator(BiPredicate<String, SkriptParser.ParseResult> inputValidator) Sets an additional validator that must accept the input and parse result for this value to match.Adds one or more patterns matched against user input.registerChanger(Changer.ChangeMode mode, EventValue.Changer<E, V> changer) Registers a changer for the event value.time(EventValue.Time time) Sets the time state for which this event value is registered.
-
Method Details
-
patterns
Adds one or more patterns matched against user input.- Parameters:
patterns- Skript patterns- Returns:
- this builder
-
inputValidator
@Contract(value="_ -> this", mutates="this") EventValue.Builder<E,V> inputValidator(BiPredicate<String, SkriptParser.ParseResult> inputValidator) Sets an additional validator that must accept the input and parse result for this value to match.- Parameters:
inputValidator- predicate invoked after pattern match- Returns:
- this builder
-
eventValidator
@Contract(value="_ -> this", mutates="this") EventValue.Builder<E,V> eventValidator(Function<Class<?>, EventValue.Validation> eventValidator) Sets an event-type validator that must accept the event class for this value to be valid.- Parameters:
eventValidator- predicate to validate event classes- Returns:
- this builder
-
getter
@Contract(value="_ -> this", mutates="this") EventValue.Builder<E,V> getter(Converter<E, V> converter) Sets the converter used to obtain the value from the event.- Parameters:
converter- the value converter- Returns:
- this builder
-
registerChanger
@Contract(value="_, _ -> this", mutates="this") EventValue.Builder<E,V> registerChanger(Changer.ChangeMode mode, EventValue.Changer<E, V> changer) Registers a changer for the event value.- Parameters:
mode- the change modechanger- the changer implementation- Returns:
- this builder
-
time
Sets the time state for which this event value is registered.- Parameters:
time- the time state- Returns:
- this builder
-
excludes
@Contract(value="_ -> this", mutates="this") default EventValue.Builder<E,V> excludes(Class<? extends E> event) Excludes a specific event subclass from using this event value.- Parameters:
event- event class to exclude- Returns:
- this builder
-
excludes
@Contract(value="_, _ -> this", mutates="this") default EventValue.Builder<E,V> excludes(Class<? extends E> event1, Class<? extends E> event2) Excludes specific event subclasses from using this event value.- Parameters:
event1- first event class to excludeevent2- second event class to exclude- Returns:
- this builder
-
excludes
@Contract(value="_, _, _ -> this", mutates="this") default EventValue.Builder<E,V> excludes(Class<? extends E> event1, Class<? extends E> event2, Class<? extends E> event3) Excludes specific event subclasses from using this event value.- Parameters:
event1- first event class to excludeevent2- second event class to excludeevent3- third event class to exclude- Returns:
- this builder
-
excludes
@Contract(value="_ -> this", mutates="this") EventValue.Builder<E,V> excludes(Class<? extends E>[] events) Excludes specific event subclasses from using this event value.- Parameters:
events- event classes to exclude- Returns:
- this builder
-
excludedErrorMessage
@Contract(value="_ -> this", mutates="this") EventValue.Builder<E,V> excludedErrorMessage(String excludedErrorMessage) Sets an error message to be shown if this event value is selected for an excluded event.- Parameters:
excludedErrorMessage- the message to display- Returns:
- this builder
-
build
EventValue<E,V> build()Builds the event value.- Returns:
- the constructed event value instance
-