Class ContextValue<C extends TriggerContext, T>
java.lang.Object
io.github.syst3ms.skriptparser.registration.context.ContextValue<C,T>
A class containing info about a context value.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enum to indicate the relative position in time between two similar context values.static enumOne can use context values in two different ways:context-something- the value is used with the common prefix 'context'; orsomething- the value is used alone as an expression. The usage determines which of the two variants, or both, are applicable. -
Constructor Summary
ConstructorsConstructorDescriptionContextValue(Class<C> context, Type<T> returnType, boolean isSingle, PatternElement pattern, @Nullable Function<C, T> singleFunction, @Nullable Function<C, T[]> listFunction, @Nullable BiConsumer<C, T> singleSetterFunction, @Nullable BiConsumer<C, T[]> listSetterFunction, ContextValue.State state, ContextValue.Usage usage, @Nullable String description, Class<? extends C>[] excluded) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBeSet()static <C extends TriggerContext, T>
ContextValue<C, T> createList(Class<C> context, Type<T> returnType, PatternElement pattern, Function<C, T[]> listFunction, BiConsumer<C, T[]> listSetterFunction, ContextValue.State state, ContextValue.Usage usage, @Nullable String description, Class<? extends C>[] excluded) static <C extends TriggerContext, T>
ContextValue<C, T> createSingle(Class<C> context, Type<T> returnType, PatternElement pattern, Function<C, T> singleFunction, BiConsumer<C, T> singleSetterFunction, ContextValue.State state, ContextValue.Usage usage, @Nullable String description, Class<? extends C>[] excluded) Get the description of this context value.Some subclasses don't want to inherit the context values of their parents.Returns the function that will be applied onto the context in order to retrieve the correct value.BiConsumer<C, T[]> Returns the pattern of this context value.BiConsumer<C, T> getState()A contextual expression mostly refers to things that happen because of the event, but, sometimes, an event can have a former and future aspect.getUsage()booleanisSingle()
-
Constructor Details
-
ContextValue
public ContextValue(Class<C> context, Type<T> returnType, boolean isSingle, PatternElement pattern, @Nullable @Nullable Function<C, T> singleFunction, @Nullable @Nullable Function<C, T[]> listFunction, @Nullable @Nullable BiConsumer<C, T> singleSetterFunction, @Nullable @Nullable BiConsumer<C, T[]> listSetterFunction, ContextValue.State state, ContextValue.Usage usage, @Nullable @Nullable String description, Class<? extends C>[] excluded)
-
-
Method Details
-
createSingle
public static <C extends TriggerContext, T> ContextValue<C,T> createSingle(Class<C> context, Type<T> returnType, PatternElement pattern, Function<C, T> singleFunction, BiConsumer<C, T> singleSetterFunction, ContextValue.State state, ContextValue.Usage usage, @Nullable @Nullable String description, Class<? extends C>[] excluded) -
createList
public static <C extends TriggerContext, T> ContextValue<C,T> createList(Class<C> context, Type<T> returnType, PatternElement pattern, Function<C, T[]> listFunction, BiConsumer<C, T[]> listSetterFunction, ContextValue.State state, ContextValue.Usage usage, @Nullable @Nullable String description, Class<? extends C>[] excluded) -
getContext
-
getReturnType
-
isSingle
public boolean isSingle() -
getPattern
-
canBeSet
public boolean canBeSet() -
getSingleFunction
-
getSingleSetterFunction
-
getListFunction
-
getListSetterFunction
-
getState
A contextual expression mostly refers to things that happen because of the event, but, sometimes, an event can have a former and future aspect. The state of the context value describes these aspects.- Returns:
- whether this happens in the past, present or future
-
getUsage
- Returns:
- whether this value can be used alone
-
getDescription
-
getExcluded
-