Class Section.SectionContext

java.lang.Object
ch.njol.skript.lang.parser.ParserInstance.Data
ch.njol.skript.lang.Section.SectionContext
Enclosing class:
Section

protected static class Section.SectionContext extends ParserInstance.Data
  • Field Details

  • Constructor Details

    • SectionContext

      public SectionContext(ParserInstance parserInstance)
  • Method Details

    • modify

      protected <T> T modify(SectionNode sectionNode, List<TriggerItem> triggerItems, Supplier<T> supplier)
      Modifies this SectionContext temporarily, for the duration of the Supplier.get() call, reverting the changes afterwards.
      This must be used instead of manually modifying the fields of this instance, unless you also revert the changes afterwards.
      See Pull Request #4353 and Issue #4473.
    • claim

      @Internal public <Syntax extends SyntaxElement & Debuggable> boolean claim(Syntax syntax)
      Marks the section this context represents as having been 'claimed' by the current syntax. Once a syntax has claimed a section, another syntax may not claim it.
      Parameters:
      syntax - The syntax that wants to own this section
      Returns:
      True if this was successfully claimed, false if it was already owned
    • claimed

      public boolean claimed()
      Used to keep track of whether a syntax is managing the current section. Every section needs exactly one manager. This is used to detect errors such as:
      1. Two syntax both want to manage the section (e.g. an effectsection and an expression or two expressions).
      2. No syntax wants to manage the section.
      Returns:
      Whether a syntax is already managing this section context