Class HookOutcome<V>
java.lang.Object
dev.itsharshxd.zentrix.api.scenario.hook.HookOutcome<V>
- Type Parameters:
V- the substituted value type of the hook
What a scenario decided about one gameplay decision point.
Three answers are possible, and the difference matters for how a combination of scenarios resolves:
pass()— the scenario only observed, or modified the request in place. Zentrix keeps asking the remaining scenarios and finally falls back to its own behaviour.replace(Object)— the scenario supplies the result itself. No lower-priority scenario is consulted and Zentrix's own behaviour is skipped.cancel()— the behaviour must not happen at all. Again final.
Requests are mutable where a hook says so, which is what makes "observe, modify, extend" work without taking the decision away from anybody: a scenario can adjust the request and still pass.
- Since:
- 1.6.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe three answers a handler can give. -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> @NotNull HookOutcome<V> cancel()Suppress the behaviour entirely; no other scenario is consulted.booleanbooleanisPass()boolean@NotNull HookOutcome.Kindkind()static <V> @NotNull HookOutcome<V> pass()Defer: keep consulting other scenarios, then Zentrix's own behaviour.static <V> @NotNull HookOutcome<V> replace(V value) Take the decision over with this value; no other scenario is consulted.toString()value()The substituted value, empty unless this outcome is a replacement carrying a value.
-
Method Details
-
pass
Defer: keep consulting other scenarios, then Zentrix's own behaviour. -
cancel
Suppress the behaviour entirely; no other scenario is consulted. -
replace
Take the decision over with this value; no other scenario is consulted. -
kind
-
isPass
public boolean isPass() -
isCancelled
public boolean isCancelled() -
isReplacement
public boolean isReplacement() -
value
The substituted value, empty unless this outcome is a replacement carrying a value. -
toString
-