Skip filters if any state is not successful.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 3 Jan 2013 08:28:50 +0000 (09:28 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 3 Jan 2013 08:28:50 +0000 (09:28 +0100)
src/main/java/net/pterodactylus/reactor/engine/Engine.java

index 949ce12..6454419 100644 (file)
@@ -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();