Comments always update

This commit is contained in:
ElFrod0
2025-05-14 02:34:39 +02:00
parent c1d0fcf5b3
commit 138170c066
@@ -204,38 +204,63 @@ public class ConfigCache {
}
private String getString(String path, @NotNull String def, @Nullable List<String> comments) {
if (config.isSet(path)) return config.getString(path, def);
String value;
if (config.isSet(path)) {
value = config.getString(path, def);
} else {
config.set(path, def);
value = def;
}
if (comments != null) config.setComments(path, comments);
return def;
return value;
}
private boolean getBoolean(String path, boolean def, @Nullable List<String> comments) {
if (config.isSet(path)) return config.getBoolean(path, def);
boolean value;
if (config.isSet(path)) {
value = config.getBoolean(path, def);
} else {
config.set(path, def);
value = def;
}
if (comments != null) config.setComments(path, comments);
return def;
return value;
}
private double getDouble(String path, double def, @Nullable List<String> comments) {
if (config.isSet(path)) return config.getDouble(path, def);
double value;
if (config.isSet(path)) {
value = config.getDouble(path, def);
} else {
config.set(path, def);
value = def;
}
if (comments != null) config.setComments(path, comments);
return def;
return value;
}
private long getLong(String path, long def, @Nullable List<String> comments) {
if (config.isSet(path)) return config.getLong(path, def);
long value;
if (config.isSet(path)) {
value = config.getLong(path, def);
} else {
config.set(path, def);
value = def;
}
if (comments != null) config.setComments(path, comments);
return def;
return value;
}
private List<String> getList(String path, List<String> def, @Nullable List<String> comments) {
if (config.isSet(path)) return config.getStringList(path);
List<String> value;
if (config.isSet(path)) {
value = config.getStringList(path);
} else {
config.set(path, def);
value = def;
}
if (comments != null) config.setComments(path, comments);
return def;
return value;
}
private List<String> getList(String path, List<String> def) {