本帖最后由 seesaw_233 于 2016-1-9 11:51 编辑
之前那贴太伸手了... {:10_527:} 所以这次说明白点......
插件代码:复制代码
然后 Data.yml 是这样:
复制代码当我干了xx事后,插件要把它改成这样:--
Zone:
abc:
time:
player:
我是该使用
set("zone.abc.time","")set("zone.abc.player","")
还是
getConfigurationSection("Zone").createSection("abc")
getConfigurationSection("Zone.abc").createSection("time")
getConfigurationSection("Zone.abc").createSection("player")
另外。。
为啥我用
YamlConfiguration.loadConfiguration(MyData).save(MyData)
然后文件就一片空白....
{:10_524:}
插件代码:
然后 Data.yml 是这样:
当我干了xx事后,插件要把它改成这样:--
Zone:
abc:
time:
player:
我是该使用
set("zone.abc.time","")set("zone.abc.player","")
还是
getConfigurationSection("Zone").createSection("abc")
getConfigurationSection("Zone.abc").createSection("time")
getConfigurationSection("Zone.abc").createSection("player")
另外。。
为啥我用
YamlConfiguration.loadConfiguration(MyData).save(MyData)
然后文件就一片空白....
{:10_524:}
之前那贴太伸手了... {:10_527:} 所以这次说明白点......
插件代码:
- public File MyData = new File(getDataFolder,"Data.yml");
然后 Data.yml 是这样:
- Zone:
Zone:
abc:
time:
player:
我是该使用
set("zone.abc.time","")set("zone.abc.player","")
还是
getConfigurationSection("Zone").createSection("abc")
getConfigurationSection("Zone.abc").createSection("time")
getConfigurationSection("Zone.abc").createSection("player")
另外。。
为啥我用
YamlConfiguration.loadConfiguration(MyData).save(MyData)
然后文件就一片空白....
{:10_524:}
2021.12 数据,可能有更多内容
之前那贴太伸手了... {:10_527:}所以这次说明白点......插件代码:
代码:
- public File MyData = new File(getDataFolder,"Data.yml");
然后 Data.yml 是这样:
代码:
- Zone:
Zone:
abc:
time:
player:
我是该使用
set("zone.abc.time","")set("zone.abc.player","")
还是
getConfigurationSection("Zone").createSection("abc")
getConfigurationSection("Zone.abc").createSection("time")
getConfigurationSection("Zone.abc").createSection("player")
另外。。
为啥我用
YamlConfiguration.loadConfiguration(MyData).save(MyData)
然后文件就一片空白....
{:10_524:}
来人啊!!!!
- set("zone.abc.time","")set("zone.abc.player","")
- YamlConfiguration.loadConfiguration(MyData).save(MyData)
andylizi 发表于 2016-1-18 19:34
我是这样做的 第二种方法没试过
一片空白不是废话么,你先从MyData文件中加载,然后再保存为MyData文件。。 ...
然而并没有什么卵用,我早就解决了