Package ch.njol.skript.lang.function
Class Functions
java.lang.Object
ch.njol.skript.lang.function.Functions
Static methods to work with functions.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clears all function calls and removes script functions.static int
clearFunctions(String script)
Remember to callvalidateFunctions()
after calling thisstatic void
enableFunctionEvents(SkriptAddon addon)
Normally, function calls do not cause actual Bukkit events to be called.static @Nullable Function<?>
getFunction(String name)
Gets a function, if it exists.static Collection<JavaFunction<?>>
static @Nullable Signature<?>
getSignature(String name)
Gets a signature of function with given name.static @Nullable Function<?>
loadFunction(SectionNode node)
Loads a script function from given node.static @Nullable Signature<?>
loadSignature(String script, SectionNode node)
Loads the signature of function from given node.static JavaFunction<?>
registerFunction(JavaFunction<?> function)
Registers a function written in Java.static void
-
Field Details
-
currentFunction
-
functionNamePattern
- See Also:
- Constant Field Values
-
-
Method Details
-
registerFunction
Registers a function written in Java.- Returns:
- The passed function
-
loadFunction
Loads a script function from given node.- Parameters:
node
- Section node.- Returns:
- Script function, or null if something went wrong.
-
loadSignature
Loads the signature of function from given node.- Parameters:
script
- Script file name (might be used for some checks).node
- Section node.- Returns:
- Signature of function, or null if something went wrong.
-
getFunction
Gets a function, if it exists. Note that even if function exists in scripts, it might not have been parsed yet. If you want to check for existance, then usegetSignature(String)
.- Parameters:
name
- Name of function.- Returns:
- Function, or null if it does not exist.
-
getSignature
Gets a signature of function with given name.- Parameters:
name
- Name of function.- Returns:
- Signature, or null if function does not exist.
-
clearFunctions
Remember to callvalidateFunctions()
after calling this- Returns:
- How many functions were removed
-
validateFunctions
public static void validateFunctions() -
clearFunctions
public static void clearFunctions()Clears all function calls and removes script functions. -
getJavaFunctions
-
enableFunctionEvents
Normally, function calls do not cause actual Bukkit events to be called. If an addon requires such functionality, it should call this method. After doing so, the events will be called. Calling this method many times will not cause any additional changes.Note that calling events is not free; performance might vary once you have enabled that.
- Parameters:
addon
- Addon instance.
-