Package ch.njol.skript.lang.function
Class FunctionReference<T>
java.lang.Object
ch.njol.skript.lang.function.FunctionReference<T>
- All Implemented Interfaces:
Contract,Executable<org.bukkit.event.Event,T[]>
public class FunctionReference<T>
extends Object
implements Contract, Executable<org.bukkit.event.Event,T[]>
Reference to a
Skript function.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFunctionReference(String functionName, @Nullable Node node, @Nullable String script, @Nullable Class<? extends T>[] returnTypes, Expression<?>[] params) -
Method Summary
Modifier and TypeMethodDescriptionprotected T @Nullable []execute(org.bukkit.event.Event event) T[]The contract is used in preference to the function for determining return type, etc.@Nullable Class<?> getReturnType(Expression<?>... arguments) booleanisSingle()booleanisSingle(Expression<?>... arguments) booleanString @Nullable []toString(@Nullable org.bukkit.event.Event event, boolean debug) booleanvalidateFunction(boolean first) Validates this function reference.booleanvalidateParameterArity(boolean first)
-
Field Details
-
script
Script in which this reference is found. Used for function unload safety checks.
-
-
Constructor Details
-
FunctionReference
-
-
Method Details
-
validateParameterArity
public boolean validateParameterArity(boolean first) -
validateFunction
public boolean validateFunction(boolean first) Validates this function reference. Prints errors if needed.- Parameters:
first- True if this is called while loading a script. False when this is called when the function signature changes.- Returns:
- True if validation succeeded.
-
getFunction
-
returnedKeys
-
resetReturnValue
public boolean resetReturnValue() -
execute
-
isSingle
public boolean isSingle() -
isSingle
-
getReturnType
-
getReturnType
- Specified by:
getReturnTypein interfaceContract- Returns:
- What this will return, given these parameters
- See Also:
-
getContract
The contract is used in preference to the function for determining return type, etc.- Returns:
- The contract determining this function's parse-time hints, potentially this reference
-
toString
-
execute
- Specified by:
executein interfaceExecutable<org.bukkit.event.Event,T[]>
-