Class ParserInstance

java.lang.Object
ch.njol.skript.lang.parser.ParserInstance

public class ParserInstance extends Object
  • Constructor Details

    • ParserInstance

      public ParserInstance()
  • Method Details

    • get

      public static ParserInstance get()
      Returns:
      The ParserInstance for this thread.
    • getHandlers

      public HandlerList getHandlers()
      You probably shouldn't use this method.
      Returns:
      The HandlerList containing all active log handlers.
    • getNode

      public @Nullable Node getNode()
    • getCurrentScript

      public @Nullable Config getCurrentScript()
    • getCurrentOptions

      public HashMap<String,​String> getCurrentOptions()
    • getCurrentEventName

      public @Nullable String getCurrentEventName()
    • getCurrentEvents

      public @Nullable Class<? extends org.bukkit.event.Event>[] getCurrentEvents()
    • getCurrentSkriptEvent

      public @Nullable SkriptEvent getCurrentSkriptEvent()
    • getCurrentSections

      public List<TriggerSection> getCurrentSections()
    • isCurrentSection

      public boolean isCurrentSection(Class<? extends TriggerSection> sectionClass)
      Returns:
      whether getCurrentSections() contains an section instance of the given class (or subclass).
    • isCurrentSection

      @SafeVarargs public final boolean isCurrentSection(Class<? extends TriggerSection>... sectionClasses)
    • getCurrentSection

      public <T extends TriggerSection> @Nullable T getCurrentSection(Class<T> sectionClass)
      Returns:
      the outermost section which is an instance of the given class. Returns null if isCurrentSection(Class) returns false.
      See Also:
      getCurrentSections()
    • getCurrentSections

      @NotNull public <T extends TriggerSection> @NotNull List<T> getCurrentSections(Class<T> sectionClass)
      Returns:
      a List of current sections that are an instance of the given class. Modifications to the returned list are not saved.
      See Also:
      getCurrentSections()
    • getHasDelayBefore

      public Kleenean getHasDelayBefore()
      Returns:
      whether this trigger has had delays before. Any syntax elements that modify event-values, should use this (or the Kleenean provided to in SyntaxElement.init(Expression[], int, Kleenean, SkriptParser.ParseResult)) to make sure the event can't be modified when it has passed.
    • getIndentation

      public String getIndentation()
    • setNode

      public void setNode(@Nullable Node node)
    • setCurrentScript

      public void setCurrentScript(@Nullable Config currentScript)
    • setCurrentEventName

      public void setCurrentEventName(@Nullable String currentEventName)
    • setCurrentEvents

      public void setCurrentEvents(@Nullable Class<? extends org.bukkit.event.Event>[] currentEvents)
    • setCurrentSkriptEvent

      public void setCurrentSkriptEvent(@Nullable SkriptEvent currentSkriptEvent)
    • deleteCurrentSkriptEvent

      public void deleteCurrentSkriptEvent()
    • setCurrentSections

      public void setCurrentSections(List<TriggerSection> currentSections)
    • setHasDelayBefore

      public void setHasDelayBefore(Kleenean hasDelayBefore)
      This method should be called to indicate that the trigger will (possibly) be delayed from this point on.
      See Also:
      AsyncEffect
    • setIndentation

      public void setIndentation(String indentation)
    • setCurrentEvent

      @SafeVarargs public final void setCurrentEvent(String name, @Nullable Class<? extends org.bukkit.event.Event>... events)
    • deleteCurrentEvent

      public void deleteCurrentEvent()
    • isCurrentEvent

      public boolean isCurrentEvent(@Nullable Class<? extends org.bukkit.event.Event> event)
    • isCurrentEvent

      @SafeVarargs public final boolean isCurrentEvent(Class<? extends org.bukkit.event.Event>... events)
    • registerData

      public static <T extends ParserInstance.Data> void registerData(Class<T> dataClass, Function<ParserInstance,​T> dataFunction)
      Registers a data class to all ParserInstances.
      Parameters:
      dataClass - the data class to register.
      dataFunction - an instance creator for the data class.
    • isRegistered

      public static boolean isRegistered(Class<? extends ParserInstance.Data> dataClass)
    • getData

      public <T extends ParserInstance.Data> T getData(Class<T> dataClass)
      Returns:
      the data object for the given class from this ParserInstance, or null (after false has been asserted) if the given data class isn't registered.