diff --git a/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java b/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java index dcfe122d9..a64500277 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/commands/ConfigCommand.java @@ -9,6 +9,7 @@ import com.seibel.distanthorizons.core.config.types.ConfigEntry; import net.minecraft.commands.CommandSourceStack; import java.util.Arrays; +import java.util.HashSet; import java.util.List; import java.util.function.BiFunction; import java.util.function.Function; @@ -40,6 +41,7 @@ public class ConfigCommand extends AbstractCommand public LiteralArgumentBuilder buildCommand() { LiteralArgumentBuilder builder = literal("config"); + HashSet addedCommands = new HashSet<>(); for (AbstractConfigType type : ConfigBase.INSTANCE.entries) { @@ -56,6 +58,11 @@ public class ConfigCommand extends AbstractCommand continue; } + if (!addedCommands.add(configEntry.getChatCommandName())) + { + throw new IllegalStateException("Duplicate command name: " + configEntry.getChatCommandName()); + } + LiteralArgumentBuilder subcommand = literal(configEntry.getChatCommandName()) .executes(commandContext -> this.sendSuccessResponse(commandContext, "\n" +