From 346b1359e97918e3ee8ef29240c7709abd9edd85 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 3 Jan 2013 09:28:50 +0100 Subject: [PATCH] Skip filters if any state is not successful. --- src/main/java/net/pterodactylus/reactor/engine/Engine.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/pterodactylus/reactor/engine/Engine.java b/src/main/java/net/pterodactylus/reactor/engine/Engine.java index 949ce12..6454419 100644 --- a/src/main/java/net/pterodactylus/reactor/engine/Engine.java +++ b/src/main/java/net/pterodactylus/reactor/engine/Engine.java @@ -137,11 +137,15 @@ public class Engine extends AbstractExecutionThreadService { /* convert states. */ for (Filter filter : nextReaction.filters()) { - net.pterodactylus.reactor.State newState = filter.filter(state); - logger.debug(String.format("Old state is %s, new state is %s.", state, newState)); - state = newState; + if (state.success()) { + net.pterodactylus.reactor.State newState = filter.filter(state); + logger.debug(String.format("Old state is %s, new state is %s.", state, newState)); + state = newState; + } + } + if (state.success()) { + reactionExecution.addState(state); } - reactionExecution.addState(state); /* only run trigger if we have collected two states. */ Trigger trigger = nextReaction.trigger(); -- 2.7.4