Class GameplayHook<R,V>
java.lang.Object
dev.itsharshxd.zentrix.api.scenario.hook.GameplayHook<R,V>
- Type Parameters:
R- the request type handed to handlersV- the value type a handler may substitute
A typed decision point in Zentrix's default gameplay that a scenario may take over.
Each hook pairs a request type with a result type. A scenario registers a
GameplayHookHandler for the hook through its game context; Zentrix consults the
registered handlers, highest scenario priority first, whenever it reaches that decision point.
The first handler that does not pass decides the outcome, so a
combination of scenarios always resolves the same way.
The built-in hooks live in GameplayHooks. A scenario may also define its own hook and
dispatch it itself, which is how mechanics Zentrix never anticipated — custom roles, bosses,
objectives, gravity or crafting systems — stay composable between scenarios.
- Since:
- 1.6.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()@NotNull Stringid()static <R,V> @NotNull GameplayHook <R, V> Creates a hook key.toString()
-
Method Details
-
of
@NotNull public static <R,V> @NotNull GameplayHook<R,V> of(@NotNull @NotNull String id, @NotNull @NotNull Class<R> requestType, @NotNull @NotNull Class<V> valueType) Creates a hook key.Addon hooks should namespace their id, for example
myaddon:boss-spawn, so two addons cannot collide.- Parameters:
id- the stable hook identifierrequestType- the request type handed to handlersvalueType- the value type a handler may substitute
-
id
-
requestType
-
valueType
-
equals
-
hashCode
public int hashCode() -
toString
-