Skip to content

ServiceTrigger ​

com.jsmacrosce.jsmacros.core.service.ServiceTrigger

Mutable configuration for a service trigger. Obtain a registered trigger with ServiceManager.getTrigger(String) after checking its name, for example:

js
const manager = JsMacros.getServiceManager();  
if (manager.getServices().contains("example")) {
 const trigger = manager.getTrigger("example");  
 Chat.log(`${trigger.file}: enabled=${trigger.enabled}`);  
}

Constructors ​

new ServiceTrigger ​

new ServiceTrigger(Path file, boolean enabled)#
Stores the supplied path and enabled configuration flag without validating or normalizing the path.

Parameters:

  • file: path to store; may be null
  • enabled: whether the service is configured as enabled

Fields ​

enabled ​

enabled: boolean#
Whether the service is configured as enabled; this does not indicate that it is running.

file ​

file: Path#
Script path as stored in the trigger configuration.

Methods ​

equals ​

equals(Object o): boolean#
Compares service triggers by their enabled flags and paths; null paths compare equal.

Parameters:

  • o: object to compare
Returns: true for this instance or an equal ServiceTrigger; false otherwise

hashCode ​

hashCode(): int#
Computes a hash from this trigger's path and enabled flag. The result may change when either mutable field changes, so avoid using a trigger as a hash key while those fields are being modified.
Returns: hash code derived from the current field values

toScriptTrigger ​

toScriptTrigger(): ScriptTrigger#
Converts this configuration to an event trigger for the Service event. The new trigger uses file.toString(), this instance's enabled flag, and joined == false; conversion does not register or start a service. A null file causes NullPointerException.
Returns: a new service event trigger