Class SecWhile

All Implemented Interfaces:
Debuggable, SyntaxElement

@Name("While Loop") @Description("While Loop sections are loops that will just keep repeating as long as a condition is met.") @Examples({"while player is online: # be careful when using while loops with conditions that are almost always true for a long time without using \'wait %timespan%\' inside it, otherwise it will probably loop forever and crash your server","\tgive player 1 dirt","\twait 1 second","","while size of all players < 5:","\tsend \"More players are needed to begin the adventure\" to all players","\twait 5 seconds","","set {_counter} to 1","do while {_counter} > 1: # false but will increase {_counter} by 1 then get out","\tadd 1 to {_counter}"}) @Since("2.0, 2.6 (do while)") public class SecWhile extends Section
  • Constructor Details

    • SecWhile

      public SecWhile()
  • Method Details

    • init

      public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, SectionNode sectionNode, List<TriggerItem> triggerItems)
      Specified by:
      init in class Section
    • walk

      protected @Nullable TriggerItem walk(org.bukkit.event.Event e)
      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.

      Specified by:
      walk in class TriggerSection
      Returns:
      The next item to run or null to stop execution
    • setNext

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

      public @Nullable TriggerItem getActualNext()
    • toString

      public String toString(@Nullable org.bukkit.event.Event e, boolean debug)
      Parameters:
      e - The event to get information to. This is always null if debug == false.
      debug - If true this should print more information, if false this should print what is shown to the end user
      Returns:
      String representation of this object
    • reset

      public void reset()