【发布时间】:2015-10-14 22:43:59
【问题描述】:
我开发了一个 Minecraft Bukkit 插件,我想将信息保存在配置文件中。我想在我的 yaml 配置文件中保存一个数组并加载数据。这是我的 yaml 文件:
# Locations
Locations:
- name: "Survival"
position: 5
-
- name: "PVP"
position: 3
这是尝试加载数组的代码:
List<String> locations = config.getConfig().getStringList("Locations");
for(int i = 0; i < locations.size(); i++) {
String[] location = locations.toArray(new String[0]);
player.sendMessage("Name" + location[0] + ", Position" + location[1]);
}
但我没有收到聊天消息。如果我通过for 发送消息,我会收到一条消息。
【问题讨论】: