如何读取“字符串”:int数组进入HOCON配置?

时间:2017-11-22 21:47:56

标签: java hocon

所以我的配置如下所示。

"minecraft:blaze" {
"HOB Night" {
    # This Feature has not been Implemented yet
    "============Custom Drops============" {
        # True = Custom Drops, False = Vanilla
        "Enable Custom Drops: "=false
        # List out the Minecraft ID(ie. minecraft:Iron_sword) and the Number of them
        "List of Items and Amount"=
         "minecraft:dirt 5",
         "minecraft:stone 15"
    }
}

所以我到目前为止就是这个

ConfigurationManager.getInstance().getSpawnControl().getNode("minecraft:blaze", "HOB Night", "============Custom Drops============", "List of Items and Amount" ).getList(transformer)

然而......我无法弄清楚如何将'变换器'放入getList功能的那一部分......帮助?

1 个答案:

答案 0 :(得分:0)

如果你让我建议。首先,您应该重新考虑您的关键配置名称。缺少两件事,正确关闭大括号和列表需要用方括号括起来。例如:

"minecraft:blaze": {
  "HOB Night": {
    "============Custom Drops============": {
        "Enable Custom Drops: ": false,
        "List of Items and Amount": ["minecraft:dirt 5", "minecraft:stone 15"]
    }
  }
}