Class SkriptRegistration
java.lang.Object
io.github.syst3ms.skriptparser.registration.SkriptRegistration
A mutable object keeping track of all syntax and types registered by an
addon
Do not forget to call register() !- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassclassSkriptRegistration.EffectRegistrar<C extends Effect>classclassSkriptRegistration.ExpressionRegistrar<C extends Expression<? extends T>, T>static interfaceclassclassclassA class for registering types. -
Constructor Summary
ConstructorsConstructorDescriptionSkriptRegistration(SkriptAddon registerer) Construct a SkriptRegistration around a SkriptAddon.SkriptRegistration(SkriptAddon registerer, SkriptLogger logger) Construct a SkriptRegistration around a SkriptAddon and the defined SkriptLogger to use. -
Method Summary
Modifier and TypeMethodDescription<C extends TriggerContext, T>
voidaddContextType(Class<C> context, Class<T> returnType, Function<C, T> function) Registers aContextValuethat returns a single value.<C extends TriggerContext, T>
voidaddContextType(Class<C> context, Class<T> returnType, Function<C, T> function, ContextValue.State state) Registers aContextValuethat returns a single value.<C extends TriggerContext, T>
voidaddContextType(Class<C> context, Class<T> returnType, Function<C, T> function, ContextValue.State state, ContextValue.Usage usage) Registers aContextValuethat returns a single value.<C extends TriggerContext, T>
voidaddContextValue(Class<C> context, Class<T> returnType, boolean isSingle, String pattern, Function<C, T[]> function) Registers aContextValue<F,T> void addConverter(Class<F> from, Class<T> to, Function<? super F, Optional<? extends T>> converter) Registers a converter<F,T> void addConverter(Class<F> from, Class<T> to, Function<? super F, Optional<? extends T>> converter, int options) Registers a converter<C extends Effect>
voidRegisters anEffect<C extends Effect>
voidRegisters anEffectvoidaddEvent(Class<? extends SkriptEvent> c, Class<? extends TriggerContext>[] handledContexts, int priority, String... patterns) Registers aSkriptEventvoidaddEvent(Class<? extends SkriptEvent> c, Class<? extends TriggerContext>[] handledContexts, String... patterns) Registers aSkriptEvent<C extends ExecutableExpression<T>, T>
voidaddExecutableExpression(Class<C> c, Class<T> returnType, boolean isSingle, int priority, String... patterns) Registers anExecutableExpression<C extends ExecutableExpression<T>, T>
voidaddExecutableExpression(Class<C> c, Class<T> returnType, boolean isSingle, String... patterns) Registers anExecutableExpression<C extends Expression<T>, T>
voidaddExpression(Class<C> c, Class<T> returnType, boolean isSingle, int priority, String... patterns) Registers anExpression<C extends Expression<T>, T>
voidaddExpression(Class<C> c, Class<T> returnType, boolean isSingle, String... patterns) Registers anExpression<C extends Expression<T>, T>
voidaddExpression(Class<C> c, Class<T> returnType, String... patterns) Registers anExpressionwith the isSingle set to true by default.<C extends PropertyConditional<?>>
voidaddPropertyConditional(Class<C> c, int priority, String performer, ConditionalType conditionalType, String property) Registers aPropertyConditional<C extends PropertyConditional<?>>
voidaddPropertyConditional(Class<C> c, String performer, ConditionalType conditionalType, String property) Registers aPropertyConditional<C extends PropertyExpression<?,T>, T>
voidaddPropertyExpression(Class<C> c, Class<T> returnType, int priority, String property, String owner) Registers aPropertyExpression<C extends PropertyExpression<?,T>, T>
voidaddPropertyExpression(Class<C> c, Class<T> returnType, String property, String owner) Registers aPropertyExpressionvoidaddSection(Class<? extends CodeSection> c, int priority, String... patterns) Registers aCodeSectionvoidaddSection(Class<? extends CodeSection> c, String... patterns) Registers aCodeSectionvoidRegisters aTag.voidRegisters aTag.<T> voidRegisters aTypeList<ContextValue<?, ?>> List<ConverterInfo<?, ?>> List<SyntaxInfo<? extends Effect>> List<SkriptEventInfo<?>> MultiMap<Class<?>, ExpressionInfo<?, ?>> List<SyntaxInfo<? extends CodeSection>> getTags()getTypes()<C extends TriggerContext, T>
SkriptRegistration.ContextValueRegistrar<C, T> newContextValue(Class<C> context, Class<T> returnType, boolean isSingle, String pattern, Function<C, T[]> function) Starts a registration process for aContextExpression<C extends Effect>
SkriptRegistration.EffectRegistrar<C> Starts a registration process for anEffect<E extends SkriptEvent>
SkriptRegistration.EventRegistrar<E> Starts a registration process for aSkriptEvent<C extends Expression<T>, T>
SkriptRegistration.ExpressionRegistrar<C, T> newExpression(Class<C> c, Class<T> returnType, boolean isSingle, String... patterns) Starts a registration process for anExpression<C extends PropertyConditional<?>>
SkriptRegistration.ExpressionRegistrar<C, Boolean> newPropertyConditional(Class<C> c, String performer, ConditionalType conditionalType, String property) Starts a registration process for aPropertyConditional<C extends PropertyExpression<?,T>, T>
SkriptRegistration.ExpressionRegistrar<C, T> newPropertyExpression(Class<C> c, Class<T> returnType, String property, String owner) Starts a registration process for aPropertyExpression<C extends CodeSection>
SkriptRegistration.SectionRegistrar<C> newSection(Class<C> c, String... patterns) Starts a registration process for aCodeSectionStarts a registration process for aTypevoidonFinishRegistration(Consumer<SkriptAddon> consumer) Add a consumer to be called when this SkriptRegistration finishes registration.register()Adds all currently registered syntaxes to Skript's usable database.register(boolean ignoreLogs) Adds all currently registered syntaxes to Skript's usable database.
-
Constructor Details
-
SkriptRegistration
Construct a SkriptRegistration around a SkriptAddon.- Parameters:
registerer- The SkriptAddon that this SkriptRegistration will be referencing.
-
SkriptRegistration
Construct a SkriptRegistration around a SkriptAddon and the defined SkriptLogger to use.- Parameters:
registerer- The SkriptAddon that this SkriptRegistration will be referencing.logger- the SkriptLogger used in the registration process.
-
-
Method Details
-
getExpressions
- Returns:
- all currently registered expressions
-
getEffects
- Returns:
- all currently registered effects
-
getSections
- Returns:
- all currently registered sections
-
getEvents
- Returns:
- all currently registered events
-
getTypes
-
getConverters
- Returns:
- all currently registered converters
-
getContextValues
- Returns:
- all currently registered context values
-
getTags
-
getRegisterer
- Returns:
- the addon handling this registration (may be Skript itself)
-
newExpression
public <C extends Expression<T>, T> SkriptRegistration.ExpressionRegistrar<C,T> newExpression(Class<C> c, Class<T> returnType, boolean isSingle, String... patterns) Starts a registration process for anExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeisSingle- whether the Expression is a single valuepatterns- the Expression's patterns- Returns:
- an
SkriptRegistration.ExpressionRegistrarto continue the registration process
-
addExpression
public <C extends Expression<T>, T> void addExpression(Class<C> c, Class<T> returnType, String... patterns) Registers anExpressionwith the isSingle set to true by default. Mainly so you can override withExpression.isSingle()- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typepatterns- the Expression's patterns
-
addExpression
public <C extends Expression<T>, T> void addExpression(Class<C> c, Class<T> returnType, boolean isSingle, String... patterns) Registers anExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeisSingle- whether the Expression is a single valuepatterns- the Expression's patterns
-
addExpression
public <C extends Expression<T>, T> void addExpression(Class<C> c, Class<T> returnType, boolean isSingle, int priority, String... patterns) Registers anExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeisSingle- whether the Expression is a single valuepriority- the parsing priority this Expression has. 5 by default, a lower number means lower prioritypatterns- the Expression's patterns
-
newPropertyExpression
public <C extends PropertyExpression<?,T>, T> SkriptRegistration.ExpressionRegistrar<C,T> newPropertyExpression(Class<C> c, Class<T> returnType, String property, String owner) Starts a registration process for aPropertyExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeproperty- the propertyowner- the owner in the pattern- Returns:
- an
SkriptRegistration.ExpressionRegistrarto continue the registration process
-
addPropertyExpression
public <C extends PropertyExpression<?,T>, T> void addPropertyExpression(Class<C> c, Class<T> returnType, String property, String owner) Registers aPropertyExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeproperty- the propertyowner- the owner in the pattern
-
addPropertyExpression
public <C extends PropertyExpression<?,T>, T> void addPropertyExpression(Class<C> c, Class<T> returnType, int priority, String property, String owner) Registers aPropertyExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typepriority- the priorityproperty- the propertyowner- the owner in the pattern
-
newPropertyConditional
public <C extends PropertyConditional<?>> SkriptRegistration.ExpressionRegistrar<C,Boolean> newPropertyConditional(Class<C> c, String performer, ConditionalType conditionalType, String property) Starts a registration process for aPropertyConditional- Type Parameters:
C- the Expression- Parameters:
c- the Expression's classperformer- the type of the performerconditionalType- the verb used in this conditional propertyproperty- the property- Returns:
- an
SkriptRegistration.ExpressionRegistrarto continue the registration process
-
addPropertyConditional
public <C extends PropertyConditional<?>> void addPropertyConditional(Class<C> c, String performer, ConditionalType conditionalType, String property) Registers aPropertyConditional- Type Parameters:
C- the Expression- Parameters:
c- the Expression's classperformer- the type of the performerconditionalType- the verb used in this conditional propertyproperty- the property
-
addPropertyConditional
public <C extends PropertyConditional<?>> void addPropertyConditional(Class<C> c, int priority, String performer, ConditionalType conditionalType, String property) Registers aPropertyConditional- Type Parameters:
C- the Expression- Parameters:
c- the Expression's classpriority- the parsing priority this Expression has. 5 by default, a lower number means lower priorityperformer- the type of the performerconditionalType- the verb used in this conditional propertyproperty- the property
-
addExecutableExpression
public <C extends ExecutableExpression<T>, T> void addExecutableExpression(Class<C> c, Class<T> returnType, boolean isSingle, String... patterns) Registers anExecutableExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeisSingle- whether the Expression is a single valuepatterns- the Expression's patterns
-
addExecutableExpression
public <C extends ExecutableExpression<T>, T> void addExecutableExpression(Class<C> c, Class<T> returnType, boolean isSingle, int priority, String... patterns) Registers anExecutableExpression- Type Parameters:
C- the ExpressionT- the Expression's return type- Parameters:
c- the Expression's classreturnType- the Expression's return typeisSingle- whether the Expression is a single valuepatterns- the Expression's patterns
-
newEffect
public <C extends Effect> SkriptRegistration.EffectRegistrar<C> newEffect(Class<C> c, String... patterns) Starts a registration process for anEffect- Type Parameters:
C- the Effect- Parameters:
c- the Effect's classpatterns- the Effect's patterns- Returns:
- an
SkriptRegistration.EffectRegistrarto continue the registration process
-
addEffect
-
addEffect
Registers anEffect- Type Parameters:
C- the Effect- Parameters:
c- the Effect's classpriority- the parsing priority this Effect has. 5 by default, a lower number means lower prioritypatterns- the Effect's patterns
-
newSection
public <C extends CodeSection> SkriptRegistration.SectionRegistrar<C> newSection(Class<C> c, String... patterns) Starts a registration process for aCodeSection- Type Parameters:
C- the CodeSection- Parameters:
c- the CodeSection's classpatterns- the CodeSection's patterns- Returns:
- a
SkriptRegistration.SectionRegistrarto continue the registration process
-
addSection
Registers aCodeSection- Parameters:
c- the CodeSection's classpatterns- the CodeSection's patterns
-
addSection
Registers aCodeSection- Parameters:
c- the CodeSection's classpriority- the parsing priority this CodeSection has. 5 by default, a lower number means lower prioritypatterns- the CodeSection's patterns
-
newEvent
public <E extends SkriptEvent> SkriptRegistration.EventRegistrar<E> newEvent(Class<E> c, String... patterns) Starts a registration process for aSkriptEvent- Type Parameters:
E- the SkriptEvent- Parameters:
c- the SkriptEvent's classpatterns- the SkriptEvent's patterns- Returns:
- an
SkriptRegistration.EventRegistrarto continue the registration process
-
addEvent
public void addEvent(Class<? extends SkriptEvent> c, Class<? extends TriggerContext>[] handledContexts, String... patterns) Registers aSkriptEvent- Parameters:
c- the SkriptEvent's classhandledContexts- theTriggerContexts this SkriptEvent can handlepatterns- the SkriptEvent's patterns
-
addEvent
public void addEvent(Class<? extends SkriptEvent> c, Class<? extends TriggerContext>[] handledContexts, int priority, String... patterns) Registers aSkriptEvent- Parameters:
c- the SkriptEvent's classhandledContexts- theTriggerContexts this SkriptEvent can handlepriority- the parsing priority this SkriptEvent has. 5 by default, a lower number means lower prioritypatterns- the SkriptEvent's patterns
-
newContextValue
public <C extends TriggerContext, T> SkriptRegistration.ContextValueRegistrar<C,T> newContextValue(Class<C> context, Class<T> returnType, boolean isSingle, String pattern, Function<C, T[]> function) Starts a registration process for aContextExpression- Type Parameters:
C- the TriggerContext classT- the ContextValue's return type- Parameters:
context- the TriggerContext classreturnType- the returned type of this context valueisSingle- whether or not the return value is singlepattern- the patternfunction- the function that needs to be applied in order to get the context value- Returns:
- a
SkriptRegistration.ContextValueRegistrarto continue the registration process
-
addContextValue
public <C extends TriggerContext, T> void addContextValue(Class<C> context, Class<T> returnType, boolean isSingle, String pattern, Function<C, T[]> function) Registers aContextValue- Type Parameters:
C- the TriggerContext classT- the ContextValue's return type- Parameters:
context- the TriggerContext classreturnType- the returned type of this context valueisSingle- whether or not the return value is singlepattern- the patternfunction- the function that needs to be applied in order to get the context value
-
addContextType
public <C extends TriggerContext, T> void addContextType(Class<C> context, Class<T> returnType, Function<C, T> function) Registers aContextValuethat returns a single value. The base name of the return type will be used as pattern. There will be a leading '[the]' in the pattern if the context value can be used alone.- Type Parameters:
C- the TriggerContext classT- the ContextValue's return type- Parameters:
context- the TriggerContext classreturnType- the returned type of this context valuefunction- the function that needs to be applied in order to get the context value
-
addContextType
public <C extends TriggerContext, T> void addContextType(Class<C> context, Class<T> returnType, Function<C, T> function, ContextValue.State state) Registers aContextValuethat returns a single value. The base name of the return type will be used as pattern. There will be a leading '[the]' in the pattern if the context value can be used alone.- Type Parameters:
C- the TriggerContext classT- the ContextValue's return type- Parameters:
context- the TriggerContext classreturnType- the returned type of this context valuefunction- the function that needs to be applied in order to get the context valuestate- the time state- See Also:
-
addContextType
public <C extends TriggerContext, T> void addContextType(Class<C> context, Class<T> returnType, Function<C, T> function, ContextValue.State state, ContextValue.Usage usage) Registers aContextValuethat returns a single value. The base name of the return type will be used as pattern. There will be a leading '[the]' in the pattern if the context value can be used alone.- Type Parameters:
C- the TriggerContext classT- the ContextValue's return type- Parameters:
context- the TriggerContext classreturnType- the returned type of this context valuefunction- the function that needs to be applied in order to get the context valuestate- the time stateusage- the usage- See Also:
-
newType
Starts a registration process for aType- Type Parameters:
T- the represented class- Parameters:
c- the class the Type representspattern- the Type's pattern- Returns:
- an
SkriptRegistration.TypeRegistrar
-
addType
-
addConverter
-
addConverter
public <F,T> void addConverter(Class<F> from, Class<T> to, Function<? super F, Optional<? extends T>> converter, int options) Registers a converter- Type Parameters:
F- fromT- to- Parameters:
from- the class it converts fromto- the class it converts toconverter- the converteroptions- seeConverters
-
addTag
-
addTag
-
register
-
register
Adds all currently registered syntaxes to Skript's usable database.- Parameters:
ignoreLogs- whether to return the logs and close the logger, or just ignore and clear them while keeping the logger open- Returns:
- all possible errors, warnings and other logs that occurred while parsing the patterns
-
getLogger
-
onFinishRegistration
Add a consumer to be called when this SkriptRegistration finishes registration.- Parameters:
consumer- the consumer with the SkriptAddon reference.
-