diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 4592cce92a..e333ed579d 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -1,6 +1,6 @@ /* * Minecraft Forge - * Copyright (c) 2016-2021. + * Copyright (c) 2016-2022. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -85,7 +85,7 @@ public class ForgeConfig { .define("fixAdvancementLoading", true); permissionHandler = builder - .comment("") + .comment("The permission handler used by the server. Defaults to forge:default_handler if no such handler with that name is registered.") .translation("forge.configgui.permissionHandler") .define("permissionHandler", "forge:default_handler"); diff --git a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java index 788bfa2074..55c6ae2f23 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfigSpec.java @@ -1,6 +1,6 @@ /* * Minecraft Forge - * Copyright (c) 2016-2021. + * Copyright (c) 2016-2022. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -293,6 +293,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper, String> levelComments = new HashMap<>(); private List currentPath = new ArrayList<>(); private List> values = new ArrayList<>(); + private boolean hasInvalidComment = false; //Object public ConfigValue define(String path, T defaultValue) { @@ -326,6 +327,7 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper(this, path, defaultSupplier); } @@ -546,28 +548,20 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper path) { currentPath.addAll(path); + checkComment(currentPath); if (context.hasComment()) { - levelComments.put(new ArrayList(currentPath), context.buildComment()); context.setComment(); // Set to empty } @@ -629,6 +623,19 @@ public class ForgeConfigSpec extends UnmodifiableConfigWrapper path) + { + if (hasInvalidComment) + { + hasInvalidComment = false; + if (!FMLEnvironment.production) + { + LogManager.getLogger().error(CORE, "Null comment for config option {}, this is invalid and may be disallowed in the future.", + DOT_JOINER.join(path)); + } + } + } + public interface BuilderConsumer { void accept(Builder builder); }