* Returns the output of this trigger. This will only return a meaningful
* value if {@link #triggers(State, State)} returns {@code true}.
*
+ * @param reaction
+ * The reaction being triggered
* @return The output of this trigger
*/
- Output output();
+ Output output(Reaction reaction);
}
logger.debug(String.format("Trigger was hit: %s.", triggerHit));
if (triggerHit) {
logger.info("Executing Action...");
- nextReaction.action().execute(trigger.output());
+ nextReaction.action().execute(trigger.output(nextReaction));
}
}
package net.pterodactylus.reactor.triggers;
+import net.pterodactylus.reactor.Reaction;
import net.pterodactylus.reactor.State;
import net.pterodactylus.reactor.Trigger;
import net.pterodactylus.reactor.output.DefaultOutput;
* {@inheritDoc}
*/
@Override
- public Output output() {
+ public Output output(Reaction reaction) {
return new DefaultOutput("true").addText("text/plain", "true").addText("text/html", "<div>true</div>");
}
package net.pterodactylus.reactor.triggers;
+import net.pterodactylus.reactor.Reaction;
import net.pterodactylus.reactor.State;
import net.pterodactylus.reactor.Trigger;
import net.pterodactylus.reactor.output.DefaultOutput;
* {@inheritDoc}
*/
@Override
- public Output output() {
+ public Output output(Reaction reaction) {
return new DefaultOutput("File appeared/disappeared").addText("text/plain", "File appeared/disappeared").addText("text/html", "<div>File appeared/disappeared</div>");
}
package net.pterodactylus.reactor.triggers;
import static com.google.common.base.Preconditions.checkState;
+import net.pterodactylus.reactor.Reaction;
import net.pterodactylus.reactor.State;
import net.pterodactylus.reactor.Trigger;
import net.pterodactylus.reactor.output.DefaultOutput;
* {@inheritDoc}
*/
@Override
- public Output output() {
+ public Output output(Reaction reaction) {
return new DefaultOutput("File modified").addText("text/plain", "File modified").addText("text/html", "<div>File modified</div>");
}
import java.util.List;
+import net.pterodactylus.reactor.Reaction;
import net.pterodactylus.reactor.State;
import net.pterodactylus.reactor.Trigger;
import net.pterodactylus.reactor.output.DefaultOutput;
* {@inheritDoc}
*/
@Override
- public Output output() {
+ public Output output(Reaction reaction) {
DefaultOutput output = new DefaultOutput(String.format("Found %d new Torrent(s)!", torrentFiles.size()));
output.addText("text/plain", getPlainTextList(torrentFiles));
output.addText("text/html", getHtmlTextList(torrentFiles));