Package ch.njol.skript.lang.function
Class JavaFunction<T>
java.lang.Object
ch.njol.skript.lang.function.Function<T>
ch.njol.skript.lang.function.JavaFunction<T>
- Direct Known Subclasses:
SimpleJavaFunction
-
Field Summary
Fields inherited from class ch.njol.skript.lang.function.Function
executeWithNulls
-
Constructor Summary
ConstructorsConstructorDescriptionJavaFunction
(Signature<T> sign) JavaFunction
(String name, Parameter<?>[] parameters, ClassInfo<T> returnType, boolean single) JavaFunction
(String name, Parameter<?>[] parameters, ClassInfo<T> returnType, boolean single, @Nullable Contract contract) -
Method Summary
Modifier and TypeMethodDescriptiondescription
(String... description) Only used for Skript's documentation.Only used for Skript's documentation.abstract T @Nullable []
execute
(FunctionEvent<?> event, Object[][] params) Executes this function with given parameters.String @Nullable []
String @Nullable []
String @Nullable []
@Nullable String
getSince()
Only used for Skript's documentation.boolean
Resets the return value of theFunction
.@NotNull String @Nullable []
void
setReturnedKeys
(@NotNull String @Nullable [] keys) Sets the keys that will be returned by this function.Only used for Skript's documentation.Methods inherited from class ch.njol.skript.lang.function.Function
execute, getName, getParameter, getParameters, getReturnType, getSignature, isSingle, toString
-
Constructor Details
-
JavaFunction
-
JavaFunction
-
JavaFunction
-
-
Method Details
-
execute
Description copied from class:Function
Executes this function with given parameters. Usually, usingFunction.execute(Object[][])
is better; it handles optional and keyed arguments and function event creation automatically.- Specified by:
execute
in 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:
returnedKeys
in classFunction<T>
- Returns:
- The keys of the values returned by this function, or null if no keys are returned.
-
setReturnedKeys
Sets the keys that will be returned by this function.
Note: The length of the keys array must match the number of return values.- Parameters:
keys
- An array of keys to be returned by the function. Can be null.- Throws:
IllegalStateException
- If the function is returns a single value.
-
description
Only used for Skript's documentation.- Returns:
- This JavaFunction object
-
examples
Only used for Skript's documentation.- Returns:
- This JavaFunction object
-
keywords
Only used for Skript's documentation.- Parameters:
keywords
-- Returns:
- This JavaFunction object
-
since
Only used for Skript's documentation.- Returns:
- This JavaFunction object
-
getDescription
-
getExamples
-
getKeywords
-
getSince
-
resetReturnValue
public boolean resetReturnValue()Description copied from class:Function
Resets the return value of theFunction
. Should be called right after execution.- Specified by:
resetReturnValue
in classFunction<T>
- Returns:
- Whether or not the return value was successfully reset
-