private Map<String, String> getVersionFiles() { Map<String, String> files = new HashMap<String, String>(); // Add the legacy file, but as markdown so it's readable files.put("version.md", this.getMarkdownString()); // Add the config.yml File configFile = new File(this.plugin.getDataFolder(), "config.yml"); files.put(configFile.getName(), this.readFile(configFile.getAbsolutePath())); // Add the config.yml File worldConfig = new File(this.plugin.getDataFolder(), "worlds.yml"); files.put(worldConfig.getName(), this.readFile(worldConfig.getAbsolutePath())); return files; }
/** * Saves all anchors. * @return True if all anchors were successfully saved. */ public boolean saveAnchors() { try { this.anchorConfig.save(new File(this.plugin.getDataFolder(), "anchors.yml")); return true; } catch (IOException e) { this.plugin.log(Level.SEVERE, "Failed to save anchors.yml. Please check your file permissions."); return false; } }
/** * {@inheritDoc} */ @Override public boolean saveWorldsConfig() { try { this.configWorlds.options().pathSeparator(SEPARATOR); this.configWorlds.set("worlds", null); for (Map.Entry<String, WorldProperties> entry : worldsFromTheConfig.entrySet()) { this.configWorlds.set("worlds" + SEPARATOR + entry.getKey(), entry.getValue()); } this.configWorlds.save(new File(this.plugin.getDataFolder(), "worlds.yml")); return true; } catch (IOException e) { this.plugin.log(Level.SEVERE, "Could not save worlds.yml. Please check your settings."); return false; } }
/** * Saves the Multiverse-Config. * * @return Whether the Multiverse-Config was successfully saved */ public boolean saveMVConfig() { try { this.multiverseConfig.set("multiverse-configuration", getMVConfig()); this.multiverseConfig.save(new File(getDataFolder(), "config.yml")); return true; } catch (IOException e) { this.log(Level.SEVERE, "Could not save Multiverse config.yml config. Please check your file permissions."); return false; } }
this.ensureConfigIsPrepared(); try { this.configWorlds.save(new File(this.plugin.getDataFolder(), "worlds.yml")); } catch (IOException e) {
/** * Loads all anchors. */ public void loadAnchors() { this.anchors = new HashMap<String, Location>(); this.anchorConfig = YamlConfiguration.loadConfiguration(new File(this.plugin.getDataFolder(), "anchors.yml")); this.ensureConfigIsPrepared(); ConfigurationSection anchorsSection = this.anchorConfig.getConfigurationSection("anchors"); Set<String> anchorKeys = anchorsSection.getKeys(false); for (String key : anchorKeys) { //world:x,y,z:pitch:yaw Location anchorLocation = plugin.getLocationManipulation().stringToLocation(anchorsSection.getString(key, "")); if (anchorLocation != null) { Logging.config("Loading anchor: '%s'...", key); this.anchors.put(key, anchorLocation); } else { Logging.warning("The location for anchor '%s' is INVALID.", key); } } }
public void loadConfigs() { this.multiverseConfig = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "config.yml")); InputStream resourceURL = this.getClass().getResourceAsStream("/defaults/config.yml"); this.worldManager.loadWorldConfig(new File(getDataFolder(), "worlds.yml"));
@Override public void onLoad() { // Register our config SerializationConfig.registerAll(MultiverseCoreConfiguration.class); // Register our world SerializationConfig.registerAll(WorldProperties.class); // Create our DataFolder getDataFolder().mkdirs(); // Setup our Debug Log Logging.init(this); SerializationConfig.initLogging(Logging.getLogger()); // Setup our BlockSafety this.blockSafety = new SimpleBlockSafety(this); // Setup our LocationManipulation this.locationManipulation = new SimpleLocationManipulation(); // Setup our SafeTTeleporter this.safeTTeleporter = new SimpleSafeTTeleporter(this); this.unsafeCallWrapper = new UnsafeCallWrapper(this); }
FileConfiguration wconf = new YamlConfiguration(); wconf.options().pathSeparator(PATH_SEPARATOR); File worldsFile = new File(getDataFolder(), "worlds.yml"); try { wconf.load(worldsFile); wconf.save(new File(getDataFolder(), "worlds.yml")); } catch (IOException e) {