Class SecLoop

All Implemented Interfaces:
Debuggable, SyntaxElement

@Name("Loop") @Description({"Loop sections repeat their code with multiple values.","<b>loop-value</b> is the value of the currently looped variable, and <b>loop-index</b> is the last part of the variable\'s name (the part where the list variable has its asterisk *)","","Ex. if we have a variable like this {SomeVariable::%player%} then when we loop {SomeVariable::*}","<b>loop-value</b> will be the value we submit to that variable, like 500, \"Yes\", false or any object that Skript understands","and <b>loop-index</b> will be the last part of the variable {SomeVariable::THIS_PART}, in our example it will be the result of %player% which is the player name like \"Notch\".","Keep in mind that loop-index is always a string but loop-value can be any object (numbers, strings, players etc.)."}) @Examples({"loop all players:","\tsend \"Hello %loop-player%!\" to loop-player","","loop items in player\'s inventory:","\tif loop-item is dirt:","\t\tset loop-item to air","","loop 10 times:","\tsend title \"%11 - loop-value%\" and subtitle \"seconds left until the game begins\" to player for 1 second # 10, 9, 8 etc.","\twait 1 second","","loop {Coins::*}:","\tset {Coins::%loop-index%} to loop-value + 5 # Same as \"add 5 to {Coins::%loop-index%}\" where loop-index is the uuid of the player and loop-value is the actually coins value such as 200"}) @Since("1.0") public class SecLoop extends Section
  • Constructor Details

    • SecLoop

      public SecLoop()
  • 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
    • 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
    • getCurrent

      public @Nullable Object getCurrent(org.bukkit.event.Event e)
    • getLoopedExpression

      public Expression<?> getLoopedExpression()
    • setNext

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

      public @Nullable TriggerItem getActualNext()
    • exit

      public void exit(org.bukkit.event.Event event)