Package org.bukkit.configuration.file

Examples of org.bukkit.configuration.file.FileConfiguration.load()


    plugin.tiers.clear();
    FileConfiguration cs = new YamlConfiguration();
    File f = new File(plugin.getDataFolder(), "tier.yml");
    if (f.exists())
      try {
        cs.load(f);
      } catch (Exception e) {
        if (plugin.getDebug())
          plugin.log.warning(e.getMessage());
      }
    for (String name : cs.getKeys(false)) {
View Full Code Here


  public void build() {
    FileConfiguration fc = new YamlConfiguration();
    File f = new File(plugin.getDataFolder(), "custom.yml");
    if (f.exists()) {
      try {
        fc.load(f);
      } catch (Exception e) {
        if (plugin.getDebug())
          plugin.log.warning(e.getMessage());
      }
    }
View Full Code Here

    plugin.armorSets.clear();
    FileConfiguration cs = new YamlConfiguration();
    File f = new File(plugin.getDataFolder(), "set.yml");
    if (f.exists()) {
      try {
        cs.load(f);
      } catch (Exception e) {
        if (plugin.getDebug())
          plugin.log.warning(e.getMessage());
      }
    }
View Full Code Here

            plugin.saveResource("magicspells.yml", false);
            Messenger.info("magicspells.yml created.");
        }
        try {
            FileConfiguration config = new YamlConfiguration();
            config.load(file);
            setupSpells(config);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

   String filename = file.getName();
   if (filename.endsWith(".yml")) {
    String sectionName = filename.replaceAll("\\.yml$", "");
    FileConfiguration sectionConfig = new YamlConfiguration();
    sectionConfig.options().pathSeparator(this.options().pathSeparator());
    sectionConfig.load(file);
    this.putSection(sectionName, sectionConfig);
   }
  }
}
protected void putSection(String name, ConfigurationSection section) {
View Full Code Here

            }
            try {
                File langFile = new File(new File(dataFolder, "Language"), cmanager.getLanguage() + ".yml");
                if (langFile.isFile()) {
                    FileConfiguration langconfig = new YamlConfiguration();
                    langconfig.load(langFile);
                    helppages = HelpEntry.parseHelp(langconfig, "CommandHelp");
                    HelpEntry.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
                    InformationPager.setLinesPerPage(langconfig.getInt("HelpLinesPerPage", 7));
                    language = Language.parseText(langconfig, "Language");
                } else {
View Full Code Here

    private boolean checkNewLanguageVersion(String lang) throws IOException, FileNotFoundException, InvalidConfigurationException {
        File outFile = new File(new File(this.getDataFolder(), "Language"), lang + ".yml");
        File checkFile = new File(new File(this.getDataFolder(), "Language"), "temp-" + lang + ".yml");
        if (outFile.isFile()) {
            FileConfiguration testconfig = new YamlConfiguration();
            testconfig.load(outFile);
            int oldversion = testconfig.getInt("FieldsVersion", 0);
            if (!this.writeDefaultFileFromJar(checkFile, "languagefiles/" + lang + ".yml", false)) {
                return false;
            }
            FileConfiguration testconfig2 = new YamlConfiguration();
View Full Code Here

            int oldversion = testconfig.getInt("FieldsVersion", 0);
            if (!this.writeDefaultFileFromJar(checkFile, "languagefiles/" + lang + ".yml", false)) {
                return false;
            }
            FileConfiguration testconfig2 = new YamlConfiguration();
            testconfig2.load(checkFile);
            int newversion = testconfig2.getInt("FieldsVersion", oldversion);
            if (checkFile.isFile()) {
                checkFile.delete();
            }
            if (newversion > oldversion) {
View Full Code Here

    private void migrateWorldConfig() { // SUPPRESS CHECKSTYLE: MethodLength
        FileConfiguration wconf = new YamlConfiguration();
        wconf.options().pathSeparator(PATH_SEPARATOR);
        File worldsFile = new File(getDataFolder(), "worlds.yml");
        try {
            wconf.load(worldsFile);
        } catch (IOException e) {
            log(Level.WARNING, "Cannot load worlds.yml");
        } catch (InvalidConfigurationException e) {
            log(Level.WARNING, "Your worlds.yml is invalid!");
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.