Package me.nabdev.oxconfig
Class ConfigurableClassParam<T>
java.lang.Object
me.nabdev.oxconfig.ConfigurableClassParam<T>
- Type Parameters:
T
- The type of the parameter
Parameters for use with ConfigurableClass
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurableClassParam
(ConfigurableClass myClass, T val, String key) Creates a new ConfigurableClassParam with the given value and keyConfigurableClassParam
(ConfigurableClass myClass, T val, Consumer<T> setter, String key) Creates a new ConfigurableClassParam with the given value and key -
Method Summary
Modifier and TypeMethodDescriptionget()
Gets the current value of the parameter since the last reloadvoid
Sets the value of the parameter and calls the setter method Note: This does not save the value to the config file and will be overwritten on reloadboolean
Whether or not a comment should be stored.
-
Constructor Details
-
ConfigurableClassParam
Creates a new ConfigurableClassParam with the given value and key- Parameters:
myClass
- The ConfigurableClass that this parameter belongs toval
- Default valuesetter
- Setter method for the valuekey
- The json key for the value to be stored in (e.g. "kP"), must not include commas
-
ConfigurableClassParam
Creates a new ConfigurableClassParam with the given value and key- Parameters:
myClass
- The ConfigurableClass that this parameter belongs toval
- Default valuekey
- The json key for the value to be stored in (e.g. "kP"), must not include commas
-
-
Method Details
-
set
Sets the value of the parameter and calls the setter method Note: This does not save the value to the config file and will be overwritten on reload- Parameters:
val
- The new value
-
get
Gets the current value of the parameter since the last reload- Returns:
- The current value of the parameter
-
shouldStoreComment
public boolean shouldStoreComment()Whether or not a comment should be stored.- Returns:
- Whether or not a commentshould be stored.
-