public class SettingsUtil extends java.lang.Object
Constructor and Description |
---|
SettingsUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
javaOnlySetting(Settings.Setting setting)
This should always be the same as whether the setting can be parsed from or serialized to a string
|
static java.lang.String |
maybeCensor(int coord) |
static java.util.List<Settings.Setting> |
modifiedSettings(Settings settings) |
static void |
parseAndApply(Settings settings,
java.lang.String settingName,
java.lang.String settingValue) |
static void |
readAndApply(Settings settings) |
static void |
save(Settings settings) |
static java.lang.String |
settingDefaultToString(Settings.Setting setting) |
static java.lang.String |
settingToString(Settings.Setting setting) |
static java.lang.String |
settingTypeToString(Settings.Setting setting)
Gets the type of a setting and returns it as a string, with package names stripped.
|
static java.lang.String |
settingValueToString(Settings.Setting setting) |
static <T> java.lang.String |
settingValueToString(Settings.Setting<T> setting,
T value) |
public SettingsUtil()
public static void readAndApply(Settings settings)
public static java.util.List<Settings.Setting> modifiedSettings(Settings settings)
public static java.lang.String settingTypeToString(Settings.Setting setting)
For example, if the setting type is java.util.List<java.lang.String>
, this function returns
List<String>
.
setting
- The settingpublic static <T> java.lang.String settingValueToString(Settings.Setting<T> setting, T value) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static java.lang.String settingValueToString(Settings.Setting setting) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static java.lang.String settingDefaultToString(Settings.Setting setting) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static java.lang.String maybeCensor(int coord)
public static java.lang.String settingToString(Settings.Setting setting) throws java.lang.IllegalStateException
java.lang.IllegalStateException
public static boolean javaOnlySetting(Settings.Setting setting)
the
- settingpublic static void parseAndApply(Settings settings, java.lang.String settingName, java.lang.String settingValue) throws java.lang.IllegalStateException, java.lang.NumberFormatException
java.lang.IllegalStateException
java.lang.NumberFormatException