Interface ReturnHandler<T>

All Known Implementing Classes:
ReturnableTrigger, ScriptFunction

public interface ReturnHandler<T>
  • Method Details

    • loadReturnableSectionCode

      @NonExtendable default void loadReturnableSectionCode(SectionNode node)
      Loads the code in the given SectionNode using the same logic as Section.loadCode(SectionNode) and pushes the section onto the return handler stack
      This method may only be called by a Section
      Throws:
      SkriptAPIException - if this return handler is not a Section
    • loadReturnableSectionCode

      @NonExtendable default ReturnableTrigger<T> loadReturnableSectionCode(SectionNode node, String name, Class<? extends org.bukkit.event.Event>[] events)
      Loads the code in the given SectionNode using the same logic as Section.loadCode(SectionNode, String, Class[]) and pushes the section onto the return handler stack
      This method may only be called by a Section
      Parameters:
      node - the section node
      name - the name of the event(s) being used
      events - the event(s) during the section's execution
      Returns:
      a returnable trigger containing the loaded section. This should be stored and used to run the section one or more times
      Throws:
      SkriptAPIException - if this return handler is not a Section
    • loadReturnableTrigger

      @NonExtendable default ReturnableTrigger<T> loadReturnableTrigger(SectionNode node, String name, SkriptEvent event)
      Loads the code in the given SectionNode into a ReturnableTrigger.
      This is a general method to load a section node without extra logic done to the ParserInstance. The calling code is expected to manage the ParserInstance accordingly, which may vary depending on where the code being loaded is located and what state the ParserInstance is in.
      Parameters:
      node - the section node to load
      name - the name of the trigger
      event - the SkriptEvent of the trigger
      Returns:
      a returnable trigger containing the loaded section node
    • returnValues

      void returnValues(org.bukkit.event.Event event, Expression<? extends T> value)
      Called when EffReturn is executed
      Parameters:
      event - the event providing context
      value - an expression representing the value(s) to return
    • isSingleReturnValue

      boolean isSingleReturnValue()
      Returns:
      whether this return handler may accept multiple return values
    • returnValueType

      @Nullable @Nullable Class<? extends T> returnValueType()
      The return type of this return handler, or null if it can't accept return values in this context (e.g. a function without a return type).
      Returns:
      the return type