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
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
Modifier and TypeFieldDescriptionprotected final ch.njol.skript.expressions.base.SectionExpression
<?> Fields inherited from class ch.njol.skript.lang.TriggerSection
first, last
Fields inherited from class ch.njol.skript.lang.TriggerItem
parent
-
Constructor Summary
ConstructorDescriptionExpressionSection
(ch.njol.skript.expressions.base.SectionExpression<?> expression) -
Method Summary
Modifier and TypeMethodDescriptionch.njol.skript.expressions.base.SectionExpression
<?> boolean
init
(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult) This method should not be overridden unless you know what you are doing!boolean
init
(Expression<?>[] expressions, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, @Nullable SectionNode sectionNode, List<TriggerItem> triggerItems) void
loadCode
(SectionNode sectionNode) Loads the code in the givenSectionNode
, appropriately modifyingParserInstance.getCurrentSections()
.loadCodeTask
(SectionNode sectionNode, String name, @Nullable Runnable afterLoading, Class<? extends org.bukkit.event.Event>... events) void
loadOptionalCode
(SectionNode sectionNode) Loads the code usingSection.loadCode(SectionNode)
.boolean
runSection
(org.bukkit.event.Event event) void
setTriggerItems
(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 TriggerItem
walk
(org.bukkit.event.Event event) Executes this item and returns the next item to run.Methods inherited from class ch.njol.skript.lang.Section
getSyntaxTypeName, loadCode, loadCode, parse
Methods inherited from class ch.njol.skript.lang.TriggerSection
run, setNext, setParent, triggerExecutionIntent, walk
Methods inherited from class ch.njol.skript.lang.TriggerItem
debug, executionIntent, getActualNext, getIndentation, getNext, getParent, getTrigger, toString, walk
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser
-
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:Section
This method should not be overridden unless you know what you are doing!- Specified by:
init
in interfaceSyntaxElement
- Overrides:
init
in 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:TriggerItem
Executes 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:
walk
in 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:Section
Loads 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:Section
Loads 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 settinghasDelayBefore
toKleenean.UNKNOWN
if the loaded section has a possible or definite delay in it.- Overrides:
loadOptionalCode
in classSection
-
runSection
public boolean runSection(org.bukkit.event.Event event) -
setTriggerItems
Description copied from class:TriggerSection
Remember 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:
setTriggerItems
in classTriggerSection
-
loadCodeTask
public Trigger loadCodeTask(SectionNode sectionNode, String name, @Nullable @Nullable Runnable afterLoading, Class<? extends org.bukkit.event.Event>... events)
-