Lortseam 4 年之前
父節點
當前提交
dd08d6492b
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/main/java/me/lortseam/completeconfig/ConfigHandler.java

+ 3 - 0
src/main/java/me/lortseam/completeconfig/ConfigHandler.java

@@ -64,6 +64,9 @@ public final class ConfigHandler {
         if (HANDLERS.containsKey(owner)) {
             throw new IllegalArgumentException("The specified owner already created a config!");
         }
+        if (HANDLERS.values().stream().anyMatch(handler -> handler.jsonPath.equals(jsonPath))) {
+            throw new IllegalArgumentException("A config of the mod " + modID + "  with the specified branch " + Arrays.toString(branch) + " already exists!");
+        }
         HANDLERS.put(owner, this);
         config = new Config(modID, topLevelCategories, load());
     }