diff --git a/gemp-lotr/gemp-lotr-logic/pom.xml b/gemp-lotr/gemp-lotr-logic/pom.xml
index 0b2ed0aa8..8829e633c 100644
--- a/gemp-lotr/gemp-lotr-logic/pom.xml
+++ b/gemp-lotr/gemp-lotr-logic/pom.xml
@@ -43,6 +43,16 @@
commons-lang
2.5
+
+ org.hjson
+ hjson
+ 3.0.0
+
+
+ com.alibaba
+ fastjson
+ 2.0.7
+
\ No newline at end of file
diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java
index 9e6bb997d..707b38ab7 100644
--- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java
+++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/LotroCardBlueprintLibrary.java
@@ -3,7 +3,9 @@ package com.gempukku.lotro.game;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.LotroCardBlueprintBuilder;
import com.gempukku.lotro.game.packs.SetDefinition;
+import org.apache.commons.io.FilenameUtils;
import org.apache.log4j.Logger;
+import org.hjson.JsonValue;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
@@ -84,17 +86,26 @@ public class LotroCardBlueprintLibrary {
}
private void loadCards(File path, boolean initial) {
- if (path.isFile())
+ if (path.isFile()) {
loadCardsFromFile(path, initial);
- else if (path.isDirectory())
- for (File file : path.listFiles())
+ }
+ else if (path.isDirectory()) {
+ for (File file : path.listFiles()) {
loadCards(file, initial);
+ }
+ }
}
private void loadCardsFromFile(File file, boolean validateNew) {
+ String ext = FilenameUtils.getExtension(file.getName());
+ if (!ext.equalsIgnoreCase("json") && !ext.equalsIgnoreCase("hjson"))
+ return;
+
JSONParser parser = new JSONParser();
try (Reader reader = new InputStreamReader(new FileInputStream(file), "UTF-8")) {
- final JSONObject cardsFile = (JSONObject) parser.parse(reader);
+ //This will read both json and hjson, producing standard json
+ String json = JsonValue.readHjson(reader).toString();
+ final JSONObject cardsFile = (JSONObject) parser.parse(json);
final Set> cardsInFile = cardsFile.entrySet();
for (Map.Entry cardEntry : cardsInFile) {
String blueprint = cardEntry.getKey();