Package ch.njol.skript.lang
Interface ReturnHandler<T>
- All Known Implementing Classes:
ReturnableTrigger,ScriptFunction
public interface ReturnHandler<T>
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleandefault voidLoads the code in the givenSectionNodeusing the same logic asSection.loadCode(SectionNode)and pushes the section onto the return handler stack
This method may only be called by aSectiondefault ReturnableTrigger<T> loadReturnableSectionCode(SectionNode node, String name, Class<? extends Event>[] events) Loads the code in the givenSectionNodeusing the same logic asSection.loadCode(SectionNode, String, Class[])and pushes the section onto the return handler stack
This method may only be called by aSectiondefault ReturnableTrigger<T> loadReturnableTrigger(SectionNode node, String name, SkriptEvent event) Loads the code in the givenSectionNodeinto aReturnableTrigger.voidreturnValues(Event event, Expression<? extends T> value) Called whenEffReturnis executedThe return type of this return handler, or null if it can't accept return values in this context (e.g.
-
Method Details
-
loadReturnableSectionCode
Loads the code in the givenSectionNodeusing the same logic asSection.loadCode(SectionNode)and pushes the section onto the return handler stack
This method may only be called by aSection- Throws:
SkriptAPIException- if this return handler is not aSection
-
loadReturnableSectionCode
@NonExtendable default ReturnableTrigger<T> loadReturnableSectionCode(SectionNode node, String name, Class<? extends Event>[] events) Loads the code in the givenSectionNodeusing the same logic asSection.loadCode(SectionNode, String, Class[])and pushes the section onto the return handler stack
This method may only be called by aSection- Parameters:
node- the section nodename- the name of the event(s) being usedevents- the event(s) during the section's execution- Returns:
- a returnable trigger containing the loaded section. This should be stored and used to run the section one or more times
- Throws:
SkriptAPIException- if this return handler is not aSection
-
loadReturnableTrigger
@NonExtendable default ReturnableTrigger<T> loadReturnableTrigger(SectionNode node, String name, SkriptEvent event) Loads the code in the givenSectionNodeinto aReturnableTrigger.
This is a general method to load a section node without extra logic done to theParserInstance. The calling code is expected to manage theParserInstanceaccordingly, which may vary depending on where the code being loaded is located and what state theParserInstanceis in.- Parameters:
node- the section node to loadname- the name of the triggerevent- theSkriptEventof the trigger- Returns:
- a returnable trigger containing the loaded section node
-
returnValues
Called whenEffReturnis executed- Parameters:
event- the event providing contextvalue- an expression representing the value(s) to return
-
isSingleReturnValue
boolean isSingleReturnValue()- Returns:
- whether this return handler may accept multiple return values
-
returnValueType
The return type of this return handler, or null if it can't accept return values in this context (e.g. a function without a return type).- Returns:
- the return type
-