Interface IDhApiConfigValue<T>
- Type Parameters:
T
- The data type of this config.
- All Known Implementing Classes:
DhApiConfigValue
public interface IDhApiConfigValue<T>
An interface for Distant Horizon's Config.
- Since:
- API 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(Consumer<T> onValueChangeFunc) Adds aConsumer
that will be called whenever the config changes to a new value.boolean
Un-sets the config's API value.Returns the value of the config if it was set by the API.boolean
Returns the default value for this config.Returns the max value for this config, null if there is no max.Returns the min value for this config, null if there is no min.Returns the value held by this config.getValue()
Returns the active value for this config.boolean
Sets the config's value.
-
Method Details
-
getValue
T getValue()Returns the active value for this config.
Returns the True value if either the config cannot be overridden by the API or if it hasn't been set by the API. -
getTrueValue
T getTrueValue()Returns the value held by this config.
This is the value stored in the config file. -
getApiValue
T getApiValue()Returns the value of the config if it was set by the API. Returns null if the config hasn't been set by the API.- Since:
- API 2.0.0
-
setValue
Sets the config's value.
If the newValue is set to null then the config will revert to using the True Value (IE the value visible in the config menu).
If the config cannot be set via the API this method will return false.- Returns:
- true if the value was set, false otherwise.
-
clearValue
boolean clearValue()Un-sets the config's API value.
After this method is called this config will use the value set in the config menu.- Returns:
- true if the value was set, false otherwise.
- Since:
- API 2.0.0
-
getCanBeOverrodeByApi
boolean getCanBeOverrodeByApi()- Returns:
- true if this config can be set via the API, false otherwise.
-
getDefaultValue
T getDefaultValue()Returns the default value for this config. -
getMaxValue
T getMaxValue()Returns the max value for this config, null if there is no max. -
getMinValue
T getMinValue()Returns the min value for this config, null if there is no min. -
addChangeListener
Adds aConsumer
that will be called whenever the config changes to a new value.
-