Package ch.njol.skript.lang.function
Class Function<T>
java.lang.Object
ch.njol.skript.lang.function.Function<T>
- All Implemented Interfaces:
Function<T>
- Direct Known Subclasses:
JavaFunction,ScriptFunction
Functions can be called using arguments.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanExecute functions even when some parameters are not present. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract T @Nullable []execute(FunctionEvent<?> event, Object[][] params) Executes this function with given parameters.final T @Nullable []Executes this function with given parameter.getName()Parameter<?> getParameter(int index) Parameter<?>[]Gets signature of this function that contains all metadata about it.booleanisSingle()abstract booleanResets the return value of theFunction.@NotNull String @Nullable []toString()
-
Field Details
-
executeWithNulls
public static boolean executeWithNullsExecute functions even when some parameters are not present. Field is updated by SkriptConfig in case of reloads.
-
-
Constructor Details
-
Function
-
-
Method Details
-
getSignature
Gets signature of this function that contains all metadata about it.- Returns:
- A function signature.
-
signature
-
getName
-
getParameters
-
getParameter
-
isSingle
public boolean isSingle() -
getReturnType
-
execute
Executes this function with given parameter.- Parameters:
params- Function parameters. Must contain at leastSignature.getMinParameters()elements and at mostSignature.getMaxParameters()elements.- Returns:
- The result(s) of this function
-
execute
Executes this function with given parameters. Usually, usingexecute(Object[][])is better; it handles optional and keyed arguments and function event creation automatically.- 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
- Returns:
- The keys of the values returned by this function, or null if no keys are returned.
-
resetReturnValue
public abstract boolean resetReturnValue()Resets the return value of theFunction. Should be called right after execution.- Returns:
- Whether or not the return value was successfully reset
-
toString
-