Package ch.njol.skript.sections
Class SecConditional
java.lang.Object
ch.njol.skript.lang.TriggerItem
ch.njol.skript.lang.TriggerSection
ch.njol.skript.lang.Section
ch.njol.skript.sections.SecConditional
- All Implemented Interfaces:
Debuggable
,SyntaxElement
@Name("Conditionals")
@Description("Conditional sections (parse if, if, else if, else) are only executed if the conditions provided are met or else-if blocks will be executed if the \'if/else-if\' blocks before didn\'t meet their conditions, otherwise \'else\' blocks will be executed (if used) if all of the conditions before were not met.")
@Examples({"if player\'s health is greater than or equal to 4:","\tsend \"Your health is okay so far but be careful!\"","","else if player\'s health is greater than 2:","\tsend \"You need to heal ASAP, your health is very low!\"","","else: # Less than 2 hearts","\tsend \"You are about to DIE if you don\'t heal NOW. You have only %player\'s health% heart(s)!\"","","parse if plugin \"SomePluginName\" is enabled: # parse if %condition%","\t# This code will only be executed if the condition used is met otherwise Skript will not parse this section therefore will not give any errors/info about this section",""})
@Since("1.0")
public class SecConditional
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
getNext()
@Nullable TriggerItem
boolean
init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, SectionNode sectionNode, List<TriggerItem> triggerItems)
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, setNext, setParent, setTriggerItems, walk
Methods inherited from class ch.njol.skript.lang.TriggerItem
debug, getIndentation, 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
-
SecConditional
public SecConditional()
-
-
Method Details
-
init
public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelayed, SkriptParser.ParseResult parseResult, SectionNode sectionNode, List<TriggerItem> triggerItems) -
getNext
- Overrides:
getNext
in classTriggerItem
-
getNormalNext
-
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
-