Class FunctionReference<T>

java.lang.Object
ch.njol.skript.lang.function.FunctionReference<T>
All Implemented Interfaces:
Contract

public class FunctionReference<T> extends Object implements Contract
Reference to a Skript function.
  • Field Details

    • script

      @Nullable public final @Nullable String script
      Script in which this reference is found. Used for function unload safety checks.
  • Constructor Details

    • FunctionReference

      public FunctionReference(String functionName, @Nullable @Nullable Node node, @Nullable @Nullable String script, @Nullable @Nullable Class<? extends T>[] returnTypes, Expression<?>[] params)
  • 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

      @Nullable public @Nullable Function<? extends T> getFunction()
    • resetReturnValue

      public boolean resetReturnValue()
    • execute

      @Nullable protected T[] execute(org.bukkit.event.Event e)
    • isSingle

      public boolean isSingle()
    • isSingle

      public boolean isSingle(Expression<?>... arguments)
      Specified by:
      isSingle in interface Contract
      Returns:
      Whether, given these parameters, this will return a single value
      See Also:
    • getReturnType

      @Nullable public @Nullable Class<? extends T> getReturnType()
    • getReturnType

      @Nullable public @Nullable Class<?> getReturnType(Expression<?>... arguments)
      Specified by:
      getReturnType in interface Contract
      Returns:
      What this will return, given these parameters
      See Also:
    • getContract

      public Contract 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

      public String toString(@Nullable @Nullable org.bukkit.event.Event e, boolean debug)