mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-25 09:59:15 +00:00
[ci skip] cleanup
This commit is contained in:
@@ -23,6 +23,7 @@ public abstract class ConfigModules extends LeafConfig {
|
||||
|
||||
public static void initModules() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||
List<Field> enabledExperimentalModules = new ArrayList<>();
|
||||
|
||||
for (Class<?> clazz : LeafConfig.getClasses(LeafConfig.I_CONFIG_PKG)) {
|
||||
ConfigModules module = (ConfigModules) clazz.getConstructor().newInstance();
|
||||
module.onLoaded();
|
||||
@@ -35,6 +36,7 @@ public abstract class ConfigModules extends LeafConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!enabledExperimentalModules.isEmpty()) {
|
||||
LeafConfig.LOGGER.warn("You have following experimental module(s) enabled: {}, please proceed with caution!", enabledExperimentalModules.stream().map(f -> f.getDeclaringClass().getSimpleName() + "." + f.getName()).toList());
|
||||
}
|
||||
@@ -42,12 +44,14 @@ public abstract class ConfigModules extends LeafConfig {
|
||||
|
||||
private static List<Field> getAnnotatedStaticFields(Class<?> clazz, Class<? extends Annotation> annotation) {
|
||||
List<Field> fields = new ArrayList<>();
|
||||
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
if (field.isAnnotationPresent(annotation) && Modifier.isStatic(field.getModifiers())) {
|
||||
field.setAccessible(true);
|
||||
fields.add(field);
|
||||
}
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,6 @@ public class AsyncPlayerDataSave extends ConfigModules {
|
||||
**实验性功能, 在部分场景下可能丢失玩家数据!**
|
||||
异步保存玩家数据.""");
|
||||
|
||||
enabled = config().getBoolean(getBasePath() + ".enabled", enabled);
|
||||
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RegionFormatConfig extends ConfigModules {
|
||||
"Available region formats: MCA, LINEAR",
|
||||
"可用格式: MCA, LINEAR"));
|
||||
linearCompressionLevel = config.getInt(getBasePath() + ".linear-compress-level", linearCompressionLevel);
|
||||
throwOnUnknownExtension = config().getBoolean(getBasePath() + ".throw-on-unknown-extension-detected", throwOnUnknownExtension);
|
||||
throwOnUnknownExtension = config.getBoolean(getBasePath() + ".throw-on-unknown-extension-detected", throwOnUnknownExtension);
|
||||
linearFlushFrequency = config.getInt(getBasePath() + ".flush-interval-seconds", linearFlushFrequency);
|
||||
|
||||
regionFormatType = EnumRegionFileExtension.fromName(regionFormatTypeName);
|
||||
|
||||
@@ -13,6 +13,6 @@ public class SkipAIForNonAwareMob extends ConfigModules {
|
||||
|
||||
@Override
|
||||
public void onLoaded() {
|
||||
enabled = config().getBoolean(getBasePath() + ".skip-ai-for-non-aware-mob", enabled);
|
||||
enabled = config.getBoolean(getBasePath() + ".skip-ai-for-non-aware-mob", enabled);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user