public Settings(File folder) { config = new YamlStorage(new File(folder, "config.yml"), "Citizens Configuration"); root = config.getKey(""); config.load(); for (Setting setting : Setting.values()) { if (!root.keyExists(setting.path)) { setting.setAtKey(root); } else setting.loadFromKey(root); } save(); }
private static Collection<TaggedRegion> loadRegions(File file) { Collection<TaggedRegion> ret = Lists.newArrayList(); Storage storage = new NBTStorage(file, "Schematic"); storage.load(); for (DataKey sub : storage.getKey("TaggedRegions").getSubKeys()) { String name = sub.name(); for (DataKey sub2 : sub.getIntegerSubKeys()) { Location min = loadLocation(sub2.getRelative("min")); Location max = loadLocation(sub2.getRelative("max")); ret.add(new TaggedRegion(name, min, max)); } } return ret; }
public void reload() { config.load(); for (Setting setting : Setting.values()) if (root.keyExists(setting.path)) setting.loadFromKey(root); save(); }
public void save() { config.save(); }