Package ch.njol.skript.sections
Class SecWhile
java.lang.Object
ch.njol.skript.lang.TriggerItem
ch.njol.skript.lang.TriggerSection
ch.njol.skript.lang.Section
ch.njol.skript.sections.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
-
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 TypeMethodDescription@Nullable TriggerItem
boolean
init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, SectionNode sectionNode, List<TriggerItem> triggerItems)
void
reset()
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
-
SecWhile
public SecWhile()
-
-
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
-
setNext
- Overrides:
setNext
in classTriggerSection
-
getActualNext
-
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
-
reset
public void reset()
-