Class SimpleConfig
java.lang.Object
me.emafire003.dev.ohmymeteors.config.SimpleConfig
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interface -
Method Summary
Modifier and TypeMethodDescriptionbooleandelete()deletes the config file from the filesystemDeprecated.booleangetOrDefault(String key, boolean def) Returns boolean value from config corresponding to the given key, or the default boolean if the key is missing.doublegetOrDefault(String key, double def) Returns double value from config corresponding to the given key, or the default string if the key is missing or invalid.floatgetOrDefault(String key, float def) Returns float value from config corresponding to the given key, or the default string if the key is missing or invalid.intgetOrDefault(String key, int def) Returns integer value from config corresponding to the given key, or the default integer if the key is missing or invalid.getOrDefault(String key, String def) Returns string value from config corresponding to the given key, or the default string list if the key is missing.getOrDefault(String key, List<String> def) Returns string value from config corresponding to the given key, or the default string if the key is missing.getOrDefault(String key, Map<String, Integer> def) Returns string value from config corresponding to the given key, or the default string if the key is missing.doublegetOrDefaultOrMin(String key, double def, double min) Returns double value from config corresponding to the given key, or the default string if the key is missing or invalid.booleanisBroken()If any error occurred during loading or reading from the config a 'broken' flag is set, indicating that the config's state is undefined and should be discarded using `delete()`static SimpleConfig.ConfigRequestCreates new config request object, ideally `namespace` should be the name of the mod id of the requesting modvoidparseConfigEntry(String entry, int line) voidSaves a new boolean value to the config filevoidSaves a new double value to the config filevoidSaves a new int value to the config filevoidSaves a new String value to the config filevoidupdate()Used to write to file the updated values stored in the UPDATE MAPvoidupdateValues(HashMap<com.mojang.datafixers.util.Pair<String, ?>, com.mojang.datafixers.util.Pair<String, ?>> sub_map) Updates from one config version to the other
-
Method Details
-
of
Creates new config request object, ideally `namespace` should be the name of the mod id of the requesting mod- Parameters:
filename- - name of the config file- Returns:
- new config request object
-
updateValues
public void updateValues(HashMap<com.mojang.datafixers.util.Pair<String, ?>, com.mojang.datafixers.util.Pair<String, throws IOException?>> sub_map) Updates from one config version to the other- Throws:
IOException
-
update
Used to write to file the updated values stored in the UPDATE MAP- Throws:
IOException
-
parseConfigEntry
-
get
Deprecated.Queries a value from config, returns `null` if the key does not exist.- Returns:
- value corresponding to the given key
- See Also:
-
getOrDefault
-
getOrDefault
-
getOrDefault
-
getConfigCopy
-
getOrDefault
Returns integer value from config corresponding to the given key, or the default integer if the key is missing or invalid.- Returns:
- value corresponding to the given key, or the default value
-
getOrDefault
Returns boolean value from config corresponding to the given key, or the default boolean if the key is missing.- Returns:
- value corresponding to the given key, or the default value
-
getOrDefault
Returns double value from config corresponding to the given key, or the default string if the key is missing or invalid.- Returns:
- value corresponding to the given key, or the default value
-
getOrDefault
Returns float value from config corresponding to the given key, or the default string if the key is missing or invalid.- Returns:
- value corresponding to the given key, or the default value
-
getOrDefaultOrMin
Returns double value from config corresponding to the given key, or the default string if the key is missing or invalid. Returns the minimum value if the one specified is below it- Returns:
- value corresponding to the given key, or the default value
-
isBroken
public boolean isBroken()If any error occurred during loading or reading from the config a 'broken' flag is set, indicating that the config's state is undefined and should be discarded using `delete()`- Returns:
- the 'broken' flag of the configuration
-
delete
deletes the config file from the filesystem- Returns:
- true if the operation was successful
- Throws:
IOException
-
set
Saves a new boolean value to the config file -
set
-
set
Saves a new int value to the config file -
set
Saves a new double value to the config file
-