1
mirror of https://github.com/CarmJos/cn2b2t-project.git synced 2024-09-19 22:05:45 +00:00

修复数据加载

This commit is contained in:
carm 2020-05-28 19:01:43 +08:00
parent 9bd3ca159a
commit 5d6d6252ea

View File

@ -271,7 +271,12 @@ public class User {
} }
private void loadData() { private void loadData() {
this.datafile = new File(Main.getInstance().getDataFolder() + "/userdatas/", this.getInkID() + ".yml"); File userdatasFolder = new File(Main.getInstance().getDataFolder() + "/userdatas");
if (!userdatasFolder.isDirectory() || !userdatasFolder.exists()) {
userdatasFolder.mkdir();
}
this.datafile = new File(userdatasFolder, this.getInkID() + ".yml");
if (!datafile.exists()) { if (!datafile.exists()) {
try { try {
datafile.createNewFile(); datafile.createNewFile();
@ -279,7 +284,7 @@ public class User {
Bukkit.getLogger().info("Could not load file " + "/userdatas/" + "yml" + ex); Bukkit.getLogger().info("Could not load file " + "/userdatas/" + "yml" + ex);
} }
} }
datas = YamlConfiguration.loadConfiguration(datafile); this.datas = YamlConfiguration.loadConfiguration(datafile);
} }
public FileConfiguration getDatas() { public FileConfiguration getDatas() {