Package ch.njol.skript.sections
Class SecLoop
java.lang.Object
ch.njol.skript.lang.TriggerItem
ch.njol.skript.lang.TriggerSection
ch.njol.skript.lang.Section
ch.njol.skript.sections.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
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.njol.skript.lang.Section
Section.SectionContext
-
Field Summary
Fields inherited from class ch.njol.skript.lang.TriggerSection
first, last
Fields inherited from class ch.njol.skript.lang.TriggerItem
parent
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
exit(org.bukkit.event.Event event)
@Nullable TriggerItem
@Nullable Object
getCurrent(org.bukkit.event.Event e)
Expression<?>
boolean
init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, SectionNode sectionNode, List<TriggerItem> triggerItems)
setNext(@Nullable TriggerItem next)
toString(@Nullable org.bukkit.event.Event e, boolean debug)
protected @Nullable TriggerItem
walk(org.bukkit.event.Event e)
Executes this item and returns the next item to run.Methods inherited from class ch.njol.skript.lang.Section
init, loadCode, loadCode, loadOptionalCode, parse
Methods inherited from class ch.njol.skript.lang.TriggerSection
run, setParent, setTriggerItems, walk
Methods inherited from class ch.njol.skript.lang.TriggerItem
debug, getIndentation, getNext, getParent, getTrigger, toString, walk
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.njol.skript.lang.SyntaxElement
getParser
-
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) -
walk
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 classTriggerSection
- Returns:
- The next item to run or null to stop execution
-
toString
- 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
-
getLoopedExpression
-
setNext
- Overrides:
setNext
in classTriggerSection
-
getActualNext
-
exit
public void exit(org.bukkit.event.Event event)
-