Class TriggerItem

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

public abstract class TriggerItem extends Object implements Debuggable
Represents a trigger item, i.e. a trigger section, a condition or an effect.
See Also:
  • Field Details

  • Constructor Details

    • TriggerItem

      protected TriggerItem()
    • TriggerItem

      protected TriggerItem(TriggerSection parent)
  • Method Details

    • walk

      @Nullable protected @Nullable TriggerItem walk(org.bukkit.event.Event event)
      Executes this item and returns the next item to run.

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

      Parameters:
      event - The event
      Returns:
      The next item to run or null to stop execution
    • run

      protected abstract boolean run(org.bukkit.event.Event event)
      Executes this item.
      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

      public static boolean walk(TriggerItem start, org.bukkit.event.Event event)
      Parameters:
      start - The item to start at
      event - The event to run the items with
      Returns:
      false if an exception occurred
    • executionIntent

      @Nullable public @Nullable ExecutionIntent executionIntent()
      Returns whether this item stops the execution of the current trigger or section(s).
      If present, and there are statement(s) after this one, the parser will print a warning to the user.

      Note: This method is used purely to print warnings and doesn't affect parsing, execution or anything else.

      Returns:
      whether this item stops the execution of the current trigger or section.
    • getIndentation

      public String getIndentation()
    • debug

      protected final void debug(org.bukkit.event.Event event, boolean run)
    • toString

      public final String toString()
      Description copied from interface: Debuggable
      Should return toString(null, false)
      Specified by:
      toString in interface Debuggable
      Overrides:
      toString in class Object
    • setParent

      public TriggerItem setParent(@Nullable @Nullable TriggerSection parent)
    • getParent

      @Nullable public final @Nullable TriggerSection getParent()
    • getTrigger

      @Nullable public final @Nullable Trigger getTrigger()
      Returns:
      The trigger this item belongs to, or null if this is a stand-alone item (e.g. the effect of an effect command)
    • setNext

      public TriggerItem setNext(@Nullable @Nullable TriggerItem next)
    • getNext

      @Nullable public @Nullable TriggerItem getNext()
    • getActualNext

      @Nullable public @Nullable TriggerItem getActualNext()
      This method guarantees to return next TriggerItem after this item. This is not always the case for getNext(), for example, getNext() of a loop section usually returns itself.
      Returns:
      The next TriggerItem.