Interface ValueSource<K,SV>
- Type Parameters:
K- type of the keySV- type of the source value
- All Known Implementing Classes:
BukkitPlayerSource,DynamicNumberValueSource,EnumValueSource,KeyValueSource,NumberValueSource,SimpleValueSource,StringSplitSource
The source values a value generator works on, before they are turned into final values.
A generator caches one final value per source value, so the source values are the identity of what is generated. They can depend on the key or be shared by every key.
It is a Function from a key to the active source values of that key, so it can be handed to a
ValueVenue as it is.
-
Method Summary
Modifier and TypeMethodDescriptionThe source values exposed for the key: the stream of the key, without the inactive values.All source values that do not depend on a key.getSourceValueStream(K key) Source values to expose for the given key.default booleanisSourceValueActivated(SV value) Whether a source value is currently active.Resolves a variable of the source value.
-
Method Details
-
getSourceValueStream
All source values that do not depend on a key.Empty by default: a source that only knows its values through
getSourceValueStream(Object)needs no override.- Returns:
- stream of every key-independent source value
-
getSourceValueStream
Source values to expose for the given key. Defaults togetSourceValueStream().- Parameters:
key- key whose source values are requested- Returns:
- stream of source values for the key
-
isSourceValueActivated
Whether a source value is currently active.- Parameters:
value- source value to check- Returns:
- true if the value may be exposed
-
apply
The source values exposed for the key: the stream of the key, without the inactive values. -
replace
Resolves a variable of the source value.- Parameters:
input- name of the variable, without its markersvalue- source value the variable is resolved for- Returns:
- the replacement, or null if the variable is not known
-