Skip to content

Commit f068019

Browse files
Remove return type from after apply in sequence
1 parent 67a5098 commit f068019

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎src/main/java/com/abilityapi/sequenceapi/Sequence.java‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,8 @@ public boolean applyObserve(final T event, final SequenceContext sequenceContext
116116
* with an appropriate {@link SequenceContext}.
117117
*
118118
* @param sequenceContext the sequence context
119-
* @return true if the action was successful and false if it was not
120119
*/
121-
public boolean applyAfter(final SequenceContext sequenceContext) {
120+
public void applyAfter(final SequenceContext sequenceContext) {
122121
final ListIterator<Action> iterator = this.actions.listIterator();
123122

124123
if (iterator.hasNext()) {
@@ -127,7 +126,7 @@ public boolean applyAfter(final SequenceContext sequenceContext) {
127126
final AfterAction action;
128127
if (rawAction instanceof AfterAction) {
129128
action = (AfterAction) rawAction;
130-
} else return false;
129+
} else return;
131130

132131
if (this.state.equals(State.INACTIVE)) this.state = State.ACTIVE;
133132

@@ -136,19 +135,22 @@ public boolean applyAfter(final SequenceContext sequenceContext) {
136135
// 1. Fail the action if it is being executed before the delay.
137136

138137
if (this.lastTime + ((action.getDelay() / 20) * 1000) > current) {
139-
return false;
138+
this.fail(action, sequenceContext);
139+
return;
140140
}
141141

142142
// 2. Fail the action if it being executed after the expire.
143143

144144
if (this.lastTime + ((action.getExpire() / 20) * 1000) < current) {
145-
return this.fail(action, sequenceContext);
145+
this.fail(action, sequenceContext);
146+
return;
146147
}
147148

148149
// 3. Run the action conditions and fail if they do not pass.
149150

150151
if (!action.apply(sequenceContext)) {
151-
return this.fail(action, sequenceContext);
152+
this.fail(action, sequenceContext);
153+
return;
152154
}
153155

154156
// 4. Succeed the action, remove it, increment the index and set finish if there are no more actions left.
@@ -161,10 +163,9 @@ public boolean applyAfter(final SequenceContext sequenceContext) {
161163
if (this.index == this.actionsSize) this.state = State.FINISHED;
162164
}
163165

164-
return this.succeed(action, sequenceContext);
166+
this.succeed(action, sequenceContext);
165167
}
166168

167-
return true;
168169
}
169170

170171
/**

‎src/main/java/com/abilityapi/sequenceapi/action/type/after/AfterAction.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class AfterAction implements Action {
1414
private int delay = 0;
1515
private int expire = 0;
1616

17+
public AfterAction() {}
18+
1719
@Override
1820
public void addCondition(final Condition condition) {
1921
this.conditions.add(condition);

0 commit comments

Comments
 (0)