Package ch.njol.skript.lang
Class TriggerItem
java.lang.Object
ch.njol.skript.lang.TriggerItem
- All Implemented Interfaces:
Debuggable
- Direct Known Subclasses:
Statement,TriggerSection
Represents a trigger item, i.e. a trigger section, a condition or an effect.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voiddebug(org.bukkit.event.Event event, boolean run) @Nullable ExecutionIntentReturns whether this item stops the execution of the current trigger or section(s).@Nullable TriggerItemThis method guarantees to return nextTriggerItemafter this item.@Nullable TriggerItemgetNext()final @Nullable TriggerSectionfinal @Nullable Triggerprotected abstract booleanrun(org.bukkit.event.Event event) Executes this item.setNext(@Nullable TriggerItem next) setParent(@Nullable TriggerSection parent) final StringtoString()Should returntoString(null, false)static booleanwalk(TriggerItem start, org.bukkit.event.Event event) protected @Nullable TriggerItemwalk(org.bukkit.event.Event event) Executes this item and returns the next item to run.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.njol.skript.lang.Debuggable
toString
-
Field Details
-
parent
-
-
Constructor Details
-
TriggerItem
protected TriggerItem() -
TriggerItem
-
-
Method Details
-
walk
Executes this item and returns the next item to run.Overriding classes must call
debug(Event, boolean). If this method is overridden,run(Event)is not used anymore and can be ignored.- Parameters:
event- The event- Returns:
- The next item to run or null to stop execution
-
run
protected abstract boolean run(org.bukkit.event.Event event) Executes this item.- Parameters:
event- The event to run this item with- Returns:
- True if the next item should be run, or false for the item following this item's parent.
-
walk
- Parameters:
start- The item to start atevent- The event to run the items with- Returns:
- false if an exception occurred
-
executionIntent
Returns whether this item stops the execution of the current trigger or section(s).
If present, and there are statement(s) after this one, the parser will print a warning to the user.Note: This method is used purely to print warnings and doesn't affect parsing, execution or anything else.
- Returns:
- whether this item stops the execution of the current trigger or section.
-
getIndentation
-
debug
protected final void debug(org.bukkit.event.Event event, boolean run) -
toString
Description copied from interface:DebuggableShould returntoString(null, false)- Specified by:
toStringin interfaceDebuggable- Overrides:
toStringin classObject
-
setParent
-
getParent
-
getTrigger
- Returns:
- The trigger this item belongs to, or null if this is a stand-alone item (e.g. the effect of an effect command)
-
setNext
-
getNext
-
getActualNext
This method guarantees to return nextTriggerItemafter this item. This is not always the case forgetNext(), for example,getNext()of aloop sectionusually returns itself.- Returns:
- The next
TriggerItem.
-