Class TriggerSection

java.lang.Object
ch.njol.skript.lang.TriggerItem
ch.njol.skript.lang.TriggerSection
All Implemented Interfaces:
Debuggable
Direct Known Subclasses:
Section, Trigger

public abstract class TriggerSection extends TriggerItem
Represents a section of a trigger, e.g. a conditional or a loop
  • Field Details

    • first

      @Nullable protected @Nullable TriggerItem first
    • last

      @Nullable protected @Nullable TriggerItem last
  • Constructor Details

    • TriggerSection

      protected TriggerSection(List<TriggerItem> items)
      Reserved for new Trigger(...)
    • TriggerSection

      protected TriggerSection(SectionNode node)
    • TriggerSection

      protected TriggerSection()
      Important when using this constructor: set the items with setTriggerItems(List)!
  • Method Details

    • setTriggerItems

      protected void setTriggerItems(List<TriggerItem> items)
      Remember to add this section to ParserInstance.getCurrentSections() before parsing child elements!
       ScriptLoader.currentSections.add(this);
       setTriggerItems(ScriptLoader.loadItems(node));
       ScriptLoader.currentSections.remove(ScriptLoader.currentSections.size() - 1);
       
    • setNext

      public TriggerSection setNext(@Nullable @Nullable TriggerItem next)
      Overrides:
      setNext in class TriggerItem
    • setParent

      public TriggerSection setParent(@Nullable @Nullable TriggerSection parent)
      Overrides:
      setParent in class TriggerItem
    • run

      protected final boolean run(org.bukkit.event.Event event)
      Description copied from class: TriggerItem
      Executes this item.
      Specified by:
      run in class TriggerItem
      Parameters:
      event - The event to run this item with
      Returns:
      True if the next item should be run, or false for the item following this item's parent.
    • walk

      @Nullable protected abstract @Nullable TriggerItem walk(org.bukkit.event.Event event)
      Description copied from class: TriggerItem
      Executes this item and returns the next item to run.

      Overriding classes must call TriggerItem.debug(Event, boolean). If this method is overridden, TriggerItem.run(Event) is not used anymore and can be ignored.

      Overrides:
      walk in class TriggerItem
      Parameters:
      event - The event
      Returns:
      The next item to run or null to stop execution
    • walk

      @Nullable protected final @Nullable TriggerItem walk(org.bukkit.event.Event event, boolean run)