Package ch.njol.skript.lang.parser
Class ParserInstance
java.lang.Object
ch.njol.skript.lang.parser.ParserInstance
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An abstract class for addons that want to add data bound to a ParserInstance. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
static ParserInstance
get()
@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 Node
getNode()
boolean
isCurrentEvent(@Nullable Class<? extends org.bukkit.event.Event> event)
boolean
isCurrentEvent(Class<? extends org.bukkit.event.Event>... events)
boolean
isCurrentSection(Class<? extends TriggerSection> sectionClass)
boolean
isCurrentSection(Class<? extends TriggerSection>... sectionClasses)
static boolean
isRegistered(Class<? extends ParserInstance.Data> dataClass)
static <T extends ParserInstance.Data>
voidregisterData(Class<T> dataClass, Function<ParserInstance,T> dataFunction)
Registers a data class to allParserInstance
s.void
setCurrentEvent(String name, @Nullable Class<? extends org.bukkit.event.Event>... events)
void
setCurrentEventName(@Nullable String currentEventName)
void
setCurrentEvents(@Nullable Class<? extends org.bukkit.event.Event>[] currentEvents)
void
setCurrentScript(@Nullable Config currentScript)
void
setCurrentSections(List<TriggerSection> currentSections)
void
setCurrentSkriptEvent(@Nullable SkriptEvent currentSkriptEvent)
void
setHasDelayBefore(Kleenean hasDelayBefore)
This method should be called to indicate that the trigger will (possibly) be delayed from this point on.void
setIndentation(String indentation)
void
-
Constructor Details
-
ParserInstance
public ParserInstance()
-
-
Method Details
-
get
- Returns:
- The
ParserInstance
for this thread.
-
getHandlers
You probably shouldn't use this method.- Returns:
- The
HandlerList
containing 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
null
ifisCurrentSection(Class)
returnsfalse
. - See Also:
getCurrentSections()
-
getCurrentSections
@NotNull public <T extends TriggerSection> @NotNull List<T> getCurrentSections(Class<T> sectionClass)- Returns:
- a
List
of 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
Kleenean
provided 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 allParserInstance
s.- 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 (afterfalse
has been asserted) if the given data class isn't registered.
-