Package ch.njol.skript.lang.function
Class ScriptFunction<T>
java.lang.Object
ch.njol.skript.lang.function.Function<T>
ch.njol.skript.lang.function.ScriptFunction<T>
- All Implemented Interfaces:
ReturnHandler<T>,Function<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface ch.njol.skript.lang.ReturnHandler
ReturnHandler.ReturnHandlerStack -
Field Summary
Fields inherited from class ch.njol.skript.lang.function.Function
executeWithNulls -
Constructor Summary
ConstructorsConstructorDescriptionScriptFunction(Signature<T> sign, SectionNode node) ScriptFunction(Signature<T> sign, Script script, SectionNode node) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionT @Nullable []execute(FunctionEvent<?> event, Object[][] params) Executes this function with given parameters.final booleanbooleanResets the return value of theFunction.@NotNull String @Nullable []final voidreturnValues(org.bukkit.event.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.final voidsetReturnValue(T[] values) Deprecated, for removal: This API element is subject to removal in a future version.UsereturnValues(Event, Expression)instead.Methods inherited from class ch.njol.skript.lang.function.Function
execute, getName, getParameter, getParameters, getReturnType, getSignature, isSingle, signature, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.njol.skript.lang.ReturnHandler
loadReturnableSectionCode, loadReturnableSectionCode, loadReturnableTrigger
-
Constructor Details
-
ScriptFunction
@Deprecated(since="2.9.0", forRemoval=true) public ScriptFunction(Signature<T> sign, Script script, SectionNode node) Deprecated, for removal: This API element is subject to removal in a future version.useScriptFunction(Signature, SectionNode)instead. -
ScriptFunction
-
-
Method Details
-
execute
Description copied from class:FunctionExecutes this function with given parameters. Usually, usingFunction.execute(Object[][])is better; it handles optional and keyed arguments and function event creation automatically.- Specified by:
executein classFunction<T>- Parameters:
event- Associated function event. This is usually created by Skript.params- Function parameters. There must beSignature.getMaxParameters()amount of them, and you need to manually handle default values.- Returns:
- Function return value(s).
-
returnedKeys
- Overrides:
returnedKeysin classFunction<T>- Returns:
- The keys of the values returned by this function, or null if no keys are returned.
-
setReturnValue
@Deprecated(since="2.9.0", forRemoval=true) @Internal public final void setReturnValue(@Nullable T[] values) Deprecated, for removal: This API element is subject to removal in a future version.UsereturnValues(Event, Expression)instead. -
resetReturnValue
public boolean resetReturnValue()Description copied from class:FunctionResets the return value of theFunction. Should be called right after execution.- Specified by:
resetReturnValuein classFunction<T>- Returns:
- Whether or not the return value was successfully reset
-
returnValues
Description copied from interface:ReturnHandlerCalled whenEffReturnis executed- Specified by:
returnValuesin interfaceReturnHandler<T>- Parameters:
event- the event providing contextvalue- an expression representing the value(s) to return
-
isSingleReturnValue
public final boolean isSingleReturnValue()- Specified by:
isSingleReturnValuein interfaceReturnHandler<T>- Returns:
- whether this return handler may accept multiple return values
-
returnValueType
Description copied from interface:ReturnHandlerThe 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).- Specified by:
returnValueTypein interfaceReturnHandler<T>- Returns:
- the return type
-
ScriptFunction(Signature, SectionNode)instead.