Skip to content

ScriptTrigger ​

com.jsmacrosce.jsmacros.core.config.ScriptTrigger

Mutable trigger configuration used by listeners; constructing one does not register a listener or run a script.

js
const Trigger = Java.type("com.jsmacrosce.jsmacros.core.config.ScriptTrigger");  
const Type = Java.type("com.jsmacrosce.jsmacros.core.config.ScriptTrigger$TriggerType");  
const Path = Java.type("java.nio.file.Path");  
const trigger = new Trigger(Type.EVENT, "Tick", Path.of("script.js"), false, false);  
Chat.log(trigger.getEvent());

Nested types ​

Constructors ​

new ScriptTrigger ​

new ScriptTrigger(ScriptTrigger.TriggerType triggerType, String event, Path scriptFile, boolean enabled, boolean joined)#
Initializes the trigger configuration; the path is stringified and reconstructed by the other constructor.

Parameters:

  • triggerType: dispatch mode
  • event: event name or key/modifier combination
  • scriptFile: configured script path
  • enabled: whether listener execution is allowed
  • joined: whether to request joined handling where supported

Fields ​

enabled ​

enabled: boolean#
Whether listener execution is allowed; changing this does not stop an in-flight run.

event ​

event: String#
Event name, or key and modifier combination for key triggers.

joined ​

joined: boolean#
Whether joined handling is requested where the event supports it.

scriptFile ​

scriptFile: Path#
Configured script path.

triggerType ​

Selects event-name dispatch or a key-event mode.

Methods ​

copy ​

Copies a trigger's configuration into a new instance.

Parameters:

  • m: trigger to copy
Returns: new trigger with the same configuration
Returns a new trigger with this instance's configuration.
Returns: new trigger with the same configuration

equals ​

equals(ScriptTrigger macro): boolean#
Compares trigger type, case-insensitive event text, and path; enabled and joined are ignored.

Parameters:

  • macro: trigger to compare
Returns: whether those three configuration values match
equals(Object arg0): boolean#

Returns: boolean

getEnabled ​

getEnabled(): booleanSince1.2.7#
Returns whether this trigger is enabled.
Returns: true when enabled

getEvent ​

getEvent(): StringSince1.2.7#
Returns the event or key identifier associated with this trigger.
Returns: the configured event/key name

getScriptFile ​

getScriptFile(): StringSince1.2.7#
Returns the script file path as a string.
Returns: the path's string representation

getScriptPath ​

getScriptPath(): PathSince2.0.0#
Returns the configured script path.
Returns: the script path

getTriggerType ​

getTriggerType(): ScriptTrigger.TriggerTypeSince1.2.7#
Returns this trigger's type.
Returns: the configured trigger type

toString ​

toString(): String#
Returns a diagnostic description of the configured type, event, path, enabled flag, and joined flag; this is not a serialization format.
Returns: diagnostic description