Package ch.njol.skript.lang
Class ExpressionSection
java.lang.Object
ch.njol.skript.lang.TriggerItem
ch.njol.skript.lang.TriggerSection
ch.njol.skript.lang.Section
ch.njol.skript.lang.ExpressionSection
- All Implemented Interfaces:
Debuggable,SyntaxElement,RuntimeErrorProducer,SyntaxRuntimeErrorProducer
A dummy trigger item representing the 'section' aspect of a
SectionExpression.
This is not a parsed or registered syntax in itself, and can be used for getting access to the parse-time features
of a section syntax (e.g. loading body code).
This is not safe to be used during runtime, since it is not a part of the trigger item tree.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.njol.skript.lang.Section
Section.SectionContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ch.njol.skript.expressions.base.SectionExpression<?> Fields inherited from class ch.njol.skript.lang.TriggerSection
first, lastFields inherited from class ch.njol.skript.lang.TriggerItem
parent -
Constructor Summary
ConstructorsConstructorDescriptionExpressionSection(ch.njol.skript.expressions.base.SectionExpression<?> expression) -
Method Summary
Modifier and TypeMethodDescriptionch.njol.skript.expressions.base.SectionExpression<?> booleaninit(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) This method should not be overridden unless you know what you are doing!booleaninit(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, @Nullable SectionNode sectionNode, List<TriggerItem> triggerItems) voidloadCode(SectionNode sectionNode) Loads the code in the givenSectionNode, appropriately modifyingParserInstance.getCurrentSections().final TriggerloadCodeTask(SectionNode sectionNode, String name, @Nullable Runnable beforeLoading, @Nullable Runnable afterLoading, Class<? extends org.bukkit.event.Event>... events) voidloadOptionalCode(SectionNode sectionNode) Loads the code usingSection.loadCode(SectionNode).booleanrunSection(org.bukkit.event.Event event) voidsetTriggerItems(List<TriggerItem> items) Remember to add this section toParserInstance.getCurrentSections()before parsing child elements!toString(@Nullable org.bukkit.event.Event event, boolean debug) protected @Nullable TriggerItemwalk(org.bukkit.event.Event event) Executes this item and returns the next item to run.Methods inherited from class ch.njol.skript.lang.Section
getNode, getSyntaxTypeName, loadCode, loadCode, loadCode, parse, preInitMethods inherited from class ch.njol.skript.lang.TriggerSection
run, setNext, setParent, triggerExecutionIntent, walkMethods inherited from class ch.njol.skript.lang.TriggerItem
debug, executionIntent, getActualNext, getIndentation, getNext, getParent, getTrigger, toString, walkMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.skriptlang.skript.log.runtime.RuntimeErrorProducer
error, error, getRuntimeErrorManager, warning, warningMethods inherited from interface ch.njol.skript.lang.SyntaxElement
getParserMethods inherited from interface org.skriptlang.skript.log.runtime.SyntaxRuntimeErrorProducer
getErrorSource
-
Field Details
-
expression
protected final ch.njol.skript.expressions.base.SectionExpression<?> expression
-
-
Constructor Details
-
ExpressionSection
public ExpressionSection(ch.njol.skript.expressions.base.SectionExpression<?> expression)
-
-
Method Details
-
init
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) Description copied from class:SectionThis method should not be overridden unless you know what you are doing!- Specified by:
initin interfaceSyntaxElement- Overrides:
initin classSection- Parameters:
expressions- all %expr%s included in the matching pattern in the order they appear in the pattern. If an optional value was left out, it will still be included in this list holding the default value of the desired type, which usually depends on the event.matchedPattern- The index of the pattern which matchedisDelayed- Whether this expression is used after a delay or not (i.e. if the event has already passed when this expression will be called)parseResult- Additional information about the match.- Returns:
- Whether this expression was initialised successfully. An error should be printed prior to returning false to specify the cause.
- See Also:
-
init
public boolean init(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, @Nullable @Nullable SectionNode sectionNode, List<TriggerItem> triggerItems) -
walk
Description copied from class:TriggerItemExecutes this item and returns the next item to run.Overriding classes must call
TriggerItem.debug(Event, boolean). If this method is overridden,TriggerItem.run(Event)is not used anymore and can be ignored.- Specified by:
walkin classTriggerSection- Parameters:
event- The event- Returns:
- The next item to run or null to stop execution
-
toString
- Parameters:
event- The event to get information from. This is always null if debug == false.debug- If true this should print more information, if false this should print what is shown to the end user- Returns:
- String representation of this object
-
getAsExpression
public ch.njol.skript.expressions.base.SectionExpression<?> getAsExpression() -
loadCode
Description copied from class:SectionLoads the code in the givenSectionNode, appropriately modifyingParserInstance.getCurrentSections().
This method itself does not modifyParserInstance.getHasDelayBefore()(although the loaded code may change it), the calling code must deal with this. -
loadOptionalCode
Description copied from class:SectionLoads the code usingSection.loadCode(SectionNode).
This method also adjustsParserInstance.getHasDelayBefore()to expect the code to be called zero or more times. This is done by settinghasDelayBeforetoKleenean.UNKNOWNif the loaded section has a possible or definite delay in it.- Overrides:
loadOptionalCodein classSection
-
runSection
public boolean runSection(org.bukkit.event.Event event) -
setTriggerItems
Description copied from class:TriggerSectionRemember to add this section toParserInstance.getCurrentSections()before parsing child elements!ScriptLoader.currentSections.add(this); setTriggerItems(ScriptLoader.loadItems(node)); ScriptLoader.currentSections.remove(ScriptLoader.currentSections.size() - 1);
- Overrides:
setTriggerItemsin classTriggerSection
-
loadCodeTask
@SafeVarargs public final Trigger loadCodeTask(SectionNode sectionNode, String name, @Nullable @Nullable Runnable beforeLoading, @Nullable @Nullable Runnable afterLoading, Class<? extends org.bukkit.event.Event>... events)
-