mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-04 10:38:19 +08:00
[skip ci] 修改部分代码格式
This commit is contained in:
@@ -34,15 +34,10 @@ public class ConfiguredList<V> extends CachedConfigValue<List<V>> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull List<V> get() {
|
public @NotNull List<V> get() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isExpired()) { // 已过时的数据,需要重新解析一次。
|
if (isExpired()) { // 已过时的数据,需要重新解析一次。
|
||||||
List<V> list = new ArrayList<>();
|
List<V> list = new ArrayList<>();
|
||||||
|
|
||||||
List<?> data = getConfiguration().getList(getConfigPath());
|
List<?> data = getConfiguration().getList(getConfigPath());
|
||||||
if (data == null || data.isEmpty()) return useOrDefault(list);
|
if (data == null || data.isEmpty()) return useOrDefault(list);
|
||||||
|
|
||||||
for (Object dataVal : data) {
|
for (Object dataVal : data) {
|
||||||
if (dataVal == null) continue;
|
if (dataVal == null) continue;
|
||||||
try {
|
try {
|
||||||
@@ -51,7 +46,6 @@ public class ConfiguredList<V> extends CachedConfigValue<List<V>> {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return updateCache(list);
|
return updateCache(list);
|
||||||
} else if (getCachedValue() != null) return getCachedValue();
|
} else if (getCachedValue() != null) return getCachedValue();
|
||||||
else if (getDefaultValue() != null) return getDefaultValue();
|
else if (getDefaultValue() != null) return getDefaultValue();
|
||||||
|
|||||||
@@ -109,9 +109,10 @@ public class ConfiguredMap<K, V> extends CachedConfigValue<Map<K, V>> {
|
|||||||
Map<String, Object> data = new LinkedHashMap<>();
|
Map<String, Object> data = new LinkedHashMap<>();
|
||||||
for (Map.Entry<K, V> entry : value.entrySet()) {
|
for (Map.Entry<K, V> entry : value.entrySet()) {
|
||||||
try {
|
try {
|
||||||
String key = keySerializer.parse(entry.getKey());
|
data.put(
|
||||||
Object val = valueSerializer.parse(entry.getValue());
|
keySerializer.parse(entry.getKey()),
|
||||||
data.put(key, val);
|
valueSerializer.parse(entry.getValue())
|
||||||
|
);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ public class ConfiguredSection<V> extends CachedConfigValue<V> {
|
|||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
setValue(serializer.parse(value));
|
setValue(serializer.parse(value));
|
||||||
// getConfiguration().createSection(getSectionPath(), serializer.parse(value));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user