Package ch.njol.skript.lang.parser
Class ParserInstance
java.lang.Object
ch.njol.skript.lang.parser.ParserInstance
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn abstract class for addons that want to add data bound to a ParserInstance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidstatic ParserInstanceget()@Nullable String@Nullable Class<? extends org.bukkit.event.Event>[]@Nullable Config<T extends TriggerSection>
@Nullable TgetCurrentSection(Class<T> sectionClass)<T extends TriggerSection>
@NotNull List<T>getCurrentSections(Class<T> sectionClass)@Nullable SkriptEvent<T extends ParserInstance.Data>
TYou probably shouldn't use this method.@Nullable NodegetNode()booleanisCurrentEvent(@Nullable Class<? extends org.bukkit.event.Event> event)booleanisCurrentEvent(Class<? extends org.bukkit.event.Event>... events)booleanisCurrentSection(Class<? extends TriggerSection> sectionClass)booleanisCurrentSection(Class<? extends TriggerSection>... sectionClasses)static booleanisRegistered(Class<? extends ParserInstance.Data> dataClass)static <T extends ParserInstance.Data>
voidregisterData(Class<T> dataClass, Function<ParserInstance,T> dataFunction)Registers a data class to allParserInstances.voidsetCurrentEvent(String name, @Nullable Class<? extends org.bukkit.event.Event>... events)voidsetCurrentEventName(@Nullable String currentEventName)voidsetCurrentEvents(@Nullable Class<? extends org.bukkit.event.Event>[] currentEvents)voidsetCurrentScript(@Nullable Config currentScript)voidsetCurrentSections(List<TriggerSection> currentSections)voidsetCurrentSkriptEvent(@Nullable SkriptEvent currentSkriptEvent)voidsetHasDelayBefore(Kleenean hasDelayBefore)This method should be called to indicate that the trigger will (possibly) be delayed from this point on.voidsetIndentation(String indentation)void
-
Constructor Details
-
ParserInstance
public ParserInstance()
-
-
Method Details
-
get
- Returns:
- The
ParserInstancefor this thread.
-
getHandlers
You probably shouldn't use this method.- Returns:
- The
HandlerListcontaining all active log handlers.
-
getNode
-
getCurrentScript
-
getCurrentOptions
-
getCurrentEventName
-
getCurrentEvents
-
getCurrentSkriptEvent
-
getCurrentSections
-
isCurrentSection
- Returns:
- whether
getCurrentSections()contains an section instance of the given class (or subclass).
-
isCurrentSection
@SafeVarargs public final boolean isCurrentSection(Class<? extends TriggerSection>... sectionClasses) -
getCurrentSection
- Returns:
- the outermost section which is an instance of the given class.
Returns
nullifisCurrentSection(Class)returnsfalse. - See Also:
getCurrentSections()
-
getCurrentSections
@NotNull public <T extends TriggerSection> @NotNull List<T> getCurrentSections(Class<T> sectionClass)- Returns:
- a
Listof current sections that are an instance of the given class. Modifications to the returned list are not saved. - See Also:
getCurrentSections()
-
getHasDelayBefore
- Returns:
- whether this trigger has had delays before.
Any syntax elements that modify event-values, should use this
(or the
Kleeneanprovided to inSyntaxElement.init(Expression[], int, Kleenean, SkriptParser.ParseResult)) to make sure the event can't be modified when it has passed.
-
getIndentation
-
setNode
-
setCurrentScript
-
setCurrentEventName
-
setCurrentEvents
-
setCurrentSkriptEvent
-
deleteCurrentSkriptEvent
public void deleteCurrentSkriptEvent() -
setCurrentSections
-
setHasDelayBefore
This method should be called to indicate that the trigger will (possibly) be delayed from this point on.- See Also:
AsyncEffect
-
setIndentation
-
setCurrentEvent
@SafeVarargs public final void setCurrentEvent(String name, @Nullable Class<? extends org.bukkit.event.Event>... events) -
deleteCurrentEvent
public void deleteCurrentEvent() -
isCurrentEvent
-
isCurrentEvent
@SafeVarargs public final boolean isCurrentEvent(Class<? extends org.bukkit.event.Event>... events) -
registerData
public static <T extends ParserInstance.Data> void registerData(Class<T> dataClass, Function<ParserInstance,T> dataFunction)Registers a data class to allParserInstances.- Parameters:
dataClass- the data class to register.dataFunction- an instance creator for the data class.
-
isRegistered
-
getData
- Returns:
- the data object for the given class from this
ParserInstance, or null (afterfalsehas been asserted) if the given data class isn't registered.
-