Package ch.njol.skript.lang.function
Class Function<T>
java.lang.Object
ch.njol.skript.lang.function.Function<T>
- Direct Known Subclasses:
JavaFunction
,ScriptFunction
Functions can be called using arguments.
-
Field Summary
Modifier and TypeFieldDescriptionstatic boolean
Execute functions even when some parameters are not present. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract T[]
execute
(FunctionEvent<?> e, Object[][] params) Executes this function with given parameters.final T[]
Executes this function with given parameter.getName()
Parameter
<?> getParameter
(int index) Parameter<?>[]
Gets signature of this function that contains all metadata about it.boolean
isSingle()
abstract boolean
Resets the return value of theFunction
.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.
-
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 arguments and function event creation automatically.- Parameters:
e
- 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).
-
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
-