9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-30 12:29:18 +00:00

Update Paper

This commit is contained in:
violetc
2025-03-29 09:43:10 +08:00
parent 324ac1170b
commit 93af7681a3
7 changed files with 30 additions and 22 deletions

View File

@@ -813,6 +813,14 @@ public final class LeavesConfig {
}
private static class AlternativePlaceValidator extends EnumConfigValidator<AlternativePlaceType> {
@Override
public void verify(AlternativePlaceType old, AlternativePlaceType value) throws IllegalArgumentException {
if (value != AlternativePlaceType.NONE) {
LeavesConfig.modify.disableDistanceCheckForUseItem = true;
}
}
@Override
public void runAfterLoader(AlternativePlaceType value, boolean reload) {
if (value != AlternativePlaceType.NONE) {
@@ -855,7 +863,7 @@ public final class LeavesConfig {
private static class AutoUpdateValidator extends BooleanConfigValidator {
@Override
public void runAfterLoader(Boolean value, boolean reload) {
if (reload) {
if (!reload) {
org.leavesmc.leaves.util.LeavesUpdateHelper.init();
if (value) {
LeavesLogger.LOGGER.warning("Auto-Update is not completely safe. Enabling it may cause data security problems!");

View File

@@ -31,7 +31,7 @@ public class GlobalConfigManager {
for (Field field : LeavesConfig.class.getDeclaredFields()) {
initField(field, null, CONFIG_START);
}
verifiedConfigs.forEach((path, config) -> config.validator().runAfterLoader(config.get(), false));
verifiedConfigs.values().forEach(config -> config.validator().runAfterLoader(config.get(), false));
LeavesConfig.save();
loaded = true;
@@ -45,7 +45,7 @@ public class GlobalConfigManager {
for (Field field : LeavesConfig.class.getDeclaredFields()) {
initField(field, null, CONFIG_START);
}
verifiedConfigs.forEach((path, config) -> config.validator().runAfterLoader(config.get(), true));
verifiedConfigs.values().stream().filter(config -> !config.lock()).forEach(config -> config.validator().runAfterLoader(config.get(), true));
LeavesConfig.save();
}