Package net.minheur.potoflux.settings
Class UserPrefsManager
java.lang.Object
net.minheur.potoflux.settings.UserPrefsManager
This class is used to store and retrieve user preferences.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectgetValueFor(@NotNull Setting setting) Returns the actual value (or default if not set) for a given setting.static ObjectgetValueFor(@NotNull ISettingType<?> type, ResourceLocation id) Returns the actual value for a given setting, from theISettingTypestatic ObjectgetValueFor(@NotNull PreferencesTypes type, Object defaultValue, ResourceLocation id) Returns the actual value (or default if not set) for a given setting.static voidsetValueFor(ResourceLocation id, PreferencesTypes type, Object value) Sets a setting valuestatic voidShows a popup to ask the user to restart the app
-
Method Details
-
getValueFor
public static Object getValueFor(@NotNull @NotNull PreferencesTypes type, Object defaultValue, ResourceLocation id) Returns the actual value (or default if not set) for a given setting.- Parameters:
type- thePreferencesTypesof the settingdefaultValue- of the setting, if no value is setid- the ressource location of the setting. Is where the setting will be written and red from.- Returns:
- the value of the setting.
- Throws:
ClassCastException- if the default value is not the correct type for the type specified
-
getValueFor
Returns the actual value for a given setting, from theISettingType- Parameters:
type- of the setting, used to get PreferencesTypes and defaultid- the resource location used as key- Returns:
- the value of the setting.
- Throws:
ClassCastException- if the default value is not the correct type for the type specified
-
getValueFor
Returns the actual value (or default if not set) for a given setting.- Parameters:
setting- used to get ISettingType, id and default- Returns:
- the value of the setting
- Throws:
ClassCastException- if the default value is not the correct type for the type specified
-
setValueFor
Sets a setting value- Parameters:
id- resource location used as keytype- type of value, used to put the right type of settingvalue- of the setting, to be set
-
showReload
public static void showReload()Shows a popup to ask the user to restart the app
-