mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-28 05:35:45 +01:00
Fix saving and loading from files. This fixes CITIZENS-30.
This commit is contained in:
parent
38e1955825
commit
5e34538bd6
@ -234,10 +234,11 @@ public class Citizens extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
config.save();
|
||||
//config.load();
|
||||
//saves.load();
|
||||
for (NPC npc : npcManager)
|
||||
((CitizensNPC) npc).save(saves.getKey("npc." + npc.getId()));
|
||||
|
||||
config.save();
|
||||
saves.save();
|
||||
}
|
||||
|
||||
@ -249,8 +250,8 @@ public class Citizens extends JavaPlugin {
|
||||
if (!key.keyExists("name"))
|
||||
throw new NPCLoadException("Could not find a name for the NPC with ID '" + id + "'.");
|
||||
|
||||
NPC npc = npcManager.createNPC(EntityType.valueOf(key.getString("traits.type").toUpperCase()), id,
|
||||
key.getString("name"), null);
|
||||
NPC npc = npcManager.createNPC(EntityType.valueOf(key.getString("traits.type").toUpperCase()), id, key
|
||||
.getString("name"), null);
|
||||
try {
|
||||
((CitizensNPC) npc).load(key);
|
||||
} catch (NPCException ex) {
|
||||
|
@ -15,6 +15,7 @@ public class Settings {
|
||||
}
|
||||
|
||||
public void load() {
|
||||
config.load();
|
||||
DataKey root = config.getKey("");
|
||||
for (Setting setting : Setting.values()) {
|
||||
if (!root.keyExists(setting.path)) {
|
||||
@ -23,7 +24,6 @@ public class Settings {
|
||||
} else
|
||||
setting.set(root.getRaw(setting.path));
|
||||
}
|
||||
save();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
|
Loading…
Reference in New Issue
Block a user