Package ch.njol.skript.lang
Class Trigger
java.lang.Object
ch.njol.skript.lang.TriggerItem
ch.njol.skript.lang.TriggerSection
ch.njol.skript.lang.Trigger
- All Implemented Interfaces:
Debuggable
- Direct Known Subclasses:
ReturnableTrigger
-
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
ConstructorDescriptionTrigger
(@Nullable Script script, String name, SkriptEvent event, List<TriggerItem> items) -
Method Summary
Modifier and TypeMethodDescriptionboolean
execute
(org.bukkit.event.Event event) Executes this trigger for a certain event.getEvent()
int
getName()
@Nullable Script
void
setDebugLabel
(String label) void
setLineNumber
(int line) Sets line number for this trigger's start.toString
(@Nullable org.bukkit.event.Event event, boolean debug) protected @Nullable TriggerItem
walk
(org.bukkit.event.Event event) Executes this item and returns the next item to run.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, getNext, getParent, getTrigger, toString, walk
-
Constructor Details
-
Trigger
public Trigger(@Nullable @Nullable Script script, String name, SkriptEvent event, List<TriggerItem> items)
-
-
Method Details
-
execute
public boolean execute(org.bukkit.event.Event event) Executes this trigger for a certain event.- Parameters:
event
- The event to execute this Trigger with.- Returns:
- false if an exception occurred.
-
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
- Parameters:
event
- The event- Returns:
- The next item to run or null to stop execution
-
toString
- Parameters:
event
- The event to get information from. 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
-
getName
- Returns:
- The name of this trigger.
-
getEvent
-
getScript
- Returns:
- The script this trigger was created from.
-
setLineNumber
public void setLineNumber(int line) Sets line number for this trigger's start. Only used for debugging.- Parameters:
line
- Line number
-
getLineNumber
public int getLineNumber()- Returns:
- The line number where this trigger starts. This should ONLY be used for debugging!
-
setDebugLabel
-
getDebugLabel
-