Package org.bukkit.configuration.file

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


        ItemStack[] armor = this.armor.remove(p);
       
        // If we can't restore from memory, restore from file
        if (items == null || armor == null) {
            YamlConfiguration config = new YamlConfiguration();
            config.load(file);
           
            // Get the items and armor lists
            List<?> itemsList = config.getList("items");
            List<?> armorList = config.getList("armor");
           
View Full Code Here


        try {
            // Grab the file and load the config
            File dir = new File(plugin.getDataFolder(), "inventories");
            File file = new File(dir, p.getName());
            YamlConfiguration config = new YamlConfiguration();
            config.load(file);
           
            // Get the items and armor lists
            List<?> itemsList = config.getList("items");
            List<?> armorList = config.getList("armor");
           
View Full Code Here

        }

        // Otherwise, load the announcements from the file
        try {
            YamlConfiguration yaml = new YamlConfiguration();
            yaml.load(file);
            ConfigUtils.addMissingRemoveObsolete(file, Msg.toYaml(), yaml);
            Msg.load(yaml);
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

    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

    }

    private static void process(Plugin plugin, String resource, ConfigurationSection section, boolean addOnlyIfEmpty, boolean removeObsolete) {
        try {
            YamlConfiguration defaults = new YamlConfiguration();
            defaults.load(plugin.getResource("res/" + resource));

            process(defaults, section, addOnlyIfEmpty, removeObsolete);
            plugin.saveConfig();
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    if (mainConfigFile == null) {
      configuration = "PEX plugin was inaccessible!";
    } else if (mainConfigFile.exists()) {
      try {
        pexConfig.load(mainConfigFile);
        successfulLoad = true;
      } catch (IOException | InvalidConfigurationException ignore) {
      }

      try {
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

            }
        }
        YamlConfiguration conf = new YamlConfiguration();
        conf.options().pathSeparator('/');
        try {
            conf.load(f);
        } catch (Exception e) {
            Bukkit.getServer().getLogger().severe("==================== Jobs ====================");
            Bukkit.getServer().getLogger().severe("Unable to load jobConfig.yml!");
            Bukkit.getServer().getLogger().severe("Check your config for formatting issues!");
            Bukkit.getServer().getLogger().severe("No jobs were loaded!");
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.