Package org.bukkit.configuration.file

Examples of org.bukkit.configuration.file.YamlConfiguration


    private static void from6() throws FileNotFoundException, IOException,
                               InvalidConfigurationException
    {
        CreeperLog.logInfo("Importing config from version 6", 1);
        YamlConfiguration config = new YamlConfiguration();
        File configFile = new File(CreeperHeal.getCHFolder() + "/config.yml");
        config.load(configFile);
        YamlConfiguration advanced = new YamlConfiguration();
        File advancedFile = new File(CreeperHeal.getCHFolder() + "/advanced.yml");
        advanced.load(advancedFile);

        blockPerBlockInterval = config.getInt("block-per-block.interval", 20);
        waitBeforeHeal = config.getInt("wait-before-heal.explosions", 60);
        blockPerBlock = config.getBoolean("block-per-block.enabled", true);
        waitBeforeHealBurnt = config.getInt("wait-before-heal.fire", 45);
        crackDestroyedBricks = config.getBoolean("crack-destroyed-bricks", false);
        boolean replaceAllChests = config.getBoolean("ignore-chests.all", false);
        replaceProtectedChests = replaceAllChests
                                 || config.getBoolean("ignore-chests.protected", false);

        logLevel = advanced.getInt("verbose-level", 1);
        teleportOnSuffocate = advanced.getBoolean("teleport-when-buried", true);
        dropDestroyedBlocks = advanced.getBoolean("drop-destroyed-blocks.enabled", true);
        dropChance = advanced.getInt("drop-destroyed-blocks.chance", 100);
        overwriteBlocks = advanced.getBoolean("replacement-conflict.overwrite", true);
        preventBlockFall = advanced.getBoolean("prevent-block-fall", true);
        distanceNear = advanced.getInt("distance-near", 20);
        lightweightMode = advanced.getBoolean("lightweight-mode", false);
        cmdAlias = advanced.getString("command-alias", "ch");
        logWarnings = advanced.getBoolean("log-warnings", true);
        preventChainReaction = advanced.getBoolean("prevent-chain-reaction", false);
        explodeObsidian = advanced.getBoolean("obsidian.explode", false);
        obsidianRadius = advanced.getInt("obsidian.radius", 5);
        obsidianChance = advanced.getInt("obsidian.chance", 20);
        debug = advanced.getBoolean("debug-messages", false);
        waitBeforeBurnAgain = advanced.getInt("wait-before-burn-again", 240);

        configFile.delete();
        advancedFile.delete();
    }
View Full Code Here


    }

    private static void from4(String name)
    {

        YamlConfiguration config = new YamlConfiguration();
        try
        {
            config.load(new File(CreeperHeal.getCHFolder() + "/config.yml"));
        } catch (Exception e)
        {
            e.printStackTrace();
            return;
        }

        creepers = getStringBoolean(name + ".Creepers", "true", config);
        tnt = getStringBoolean(name + ".TNT", "true", config);
        fire = getStringBoolean(name + ".Fire", "true", config);
        ghast = getStringBoolean(name + ".Ghast", "true", config);
        custom = getStringBoolean(name + ".Magical", "false", config);
        replaceAbove = config.getBoolean(name + ".replace-above-limit-only", false);
        replaceLimit = config.getInt(name + ".replace-limit", 64);
        enderman = config.getBoolean(name + ".block-enderman-pickup", false);
        dragons = getStringBoolean(name + ".dragons", "false", config);
        repairTime = config.getInt(name + ".repair-time", -1);

        HashSet<BlockId> restrict_list = new HashSet<BlockId>();
        try
        {
            String tmp_str1 = config.getString(name + ".restrict-list", "").trim();
            String[] split = tmp_str1.split(",");
            for (String elem : split)
                restrict_list.add(new BlockId(elem));
        } catch (NumberFormatException e)
        {
View Full Code Here

    private static void from6(String name)
    {
        File configFile = new File(CreeperHeal.getCHFolder().getPath() + "/" + name + ".yml");
        if (!configFile.exists())
            return;
        YamlConfiguration config = new YamlConfiguration();
        try
        {
            config.load(configFile);
        } catch (Exception e)
        {
            e.printStackTrace();
            return;
        }

        creepers = config.getBoolean("replace.Creepers", true);
        tnt = config.getBoolean("replace.TNT", true);
        ghast = config.getBoolean("replace.Ghast", true);
        dragons = config.getBoolean("replace.Dragons", false);
        custom = config.getBoolean("replace.Magical", false);
        fire = config.getBoolean("replace.Fire", true);
        enderman = config.getBoolean("replace.Enderman", true);
        replaceAbove = config.getBoolean("replace.replace-above-limit-only", false);
        replaceLimit = config.getInt("replace.replace-limit", 64);
        blockBlackList = loadList(config, "replace.restrict.blacklist");
        blockWhiteList = loadList(config, "replace.restrict.whitelist");
        protectList = loadList(config, "replace.protect-list");
        repairTime = config.getInt("replace.repair-time-of-day", -1);
        wither = config.getBoolean("replace.Wither", true);
        ignoreFactionsWilderness = config.getBoolean("replace.factions.ignore-wilderness", false);
        ignoreFactionsTerritory = config.getBoolean("replace.factions.ignore-territory", false);
        grassToDirt = config.getBoolean("replace.replace-grass-with-dirt", false);
        blockLava = config.getBoolean("grief.block.lava", false);
        blockTNT = config.getBoolean("grief.block.TNT", false);
        blockIgnite = config.getBoolean("grief.block.flint-and-steel", false);
        griefBlockList = config.getBoolean("grief.block.blacklist", false);
        blockSpawnEggs = config.getBoolean("grief.block.spawn-eggs", false);
        blockPvP = config.getBoolean("grief.block.PvP", false);
        warnLava = config.getBoolean("grief.warn.lava", false);
        warnTNT = config.getBoolean("grief.warn.TNT", false);
        warnIgnite = config.getBoolean("grief.warn.flint-and-steel", false);
        warnBlackList = config.getBoolean("grief.warn.blacklist", false);
        warnSpawnEggs = config.getBoolean("grief.warn.spawn-eggs", false);
        warnPvP = config.getBoolean("grief.warn.PvP", false);
        preventFireSpread = config.getBoolean("grief.prevent-fire-spread.fire", false);
        preventFireLava = config.getBoolean("grief.prevent-fire-spread.lava", false);
        placeList = loadList(config, "grief.blacklist");

        configFile.delete();
    }
View Full Code Here

            CreeperLog.warning("Trying to import a world from an uknown version.");
        }
        storeSettings(w);
        File f = new File(CreeperHeal.getCHFolder() + "/" + name + ".yml");
        f.delete();
        YamlConfiguration config = new YamlConfiguration(), advanced = new YamlConfiguration(), grief = new YamlConfiguration();
        File worldFolder = new File(CreeperHeal.getCHFolder().getPath() + "/" + name);

        File configFile = new File(worldFolder + "/config.yml");
        File advancedFile = new File(worldFolder + "/advanced.yml");
        File griefFile = new File(worldFolder + "/grief.yml");
        try
        {
            config.load(configFile);
            advanced.load(advancedFile);
            grief.load(griefFile);
        } catch (FileNotFoundException e)
        {} catch (IOException e)
        {} catch (InvalidConfigurationException e)
        {}
        for (OutDatedWCfgVal v : OutDatedWCfgVal.values())
            switch (v.getFile())
            {
            case CONFIG:
                config.set(v.getKey(), null);
                break;
            case ADVANCED:
                advanced.set(v.getKey(), null);
                break;
            case GRIEF:
                grief.set(v.getKey(), null);
                break;
            }
        try
        {
            config.save(configFile);
            advanced.save(advancedFile);
            grief.save(griefFile);
        } catch (IOException e)
        {}

        return w;
    }
View Full Code Here

        if (file == null || !file.isFile() || !file.canRead()){
            ActionLog.getInstance().warning("Unknown language file: " + locale);
            return null;
        }

        YamlConfiguration conf =  YamlConfiguration.loadConfiguration(file);

        // check all messages available
        if (fallbackMessages != null && conf.getKeys(true).size() != fallbackMessages.getKeys(true).size()){
            // collect missing message keys
            for (String key : fallbackMessages.getKeys(true)){
                if (!conf.contains(key) && !fallbackMessages.isConfigurationSection(key)){
                    conf.set(key, fallbackMessages.get(key));
                    ActionLog.getInstance().warning("Missing message key on " + locale + ".yml: " + key);
                }
            }
        }
        return conf;
View Full Code Here

  RemoteEntities m_remoteEntities;

  @Before
  public void setup()
  {
    when(this.m_remoteEntities.getConfig()).thenReturn(new YamlConfiguration());
    when(this.m_remoteEntities.onCommand(any(CommandSender.class), any(Command.class), anyString(), any(String[].class))).thenCallRealMethod();
    doCallRealMethod().when(this.m_remoteEntities).checkConfig();
  }
View Full Code Here

          customConfig = YamlConfiguration.loadConfiguration(customConfigFile);
      
          // Schaut nach den Standardwerten in der jar
          InputStream defConfigStream = plugin.getResource("customConfig.yml");
          if (defConfigStream != null) {
              YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
              customConfig.setDefaults(defConfig);
          }
      }
View Full Code Here

    (new ConfigReader()).read();

    // The infamous SpoutPlugin build check
    if (ConfigReader.isBuildCheck()) {
      InputStream is = getResource("plugin.yml");
      final YamlConfiguration config = YamlConfiguration.loadConfiguration(is);

      final String currentVersion = Bukkit.getBukkitVersion();
      final List<String> supportedVersions = config.getStringList("supportedVersions");
      if (!supportedVersions.contains(currentVersion.substring(0, 10))) {
        hardDisable = true;
        Bukkit.getPluginManager().disablePlugin(this);
        Bukkit.getLogger().warning(
            "\n-----------------------------------------------------------------------------\n" +
View Full Code Here

        if (!phrasesFile.exists()) {
            return;
        }

        YamlConfiguration phrasesConfig = YamlConfiguration.loadConfiguration(phrasesFile);

        for (Phrase phrase : Phrase.values()) {
            String phraseConfigName = phrase.getConfigName();

            String phraseMessage = phrasesConfig.getString(phraseConfigName);

            if (phraseMessage == null) {
                phraseMessage = phrase.parse();
            }
View Full Code Here

  private final File file;
  private final SettingsTree tree = new SettingsTree();

  public CachedYAMLHandler(String fileName) {
    this.file = new File(fileName);
    this.config = new YamlConfiguration();
    if (!file.exists()) {
      create();
      save();
    } else {
      load();
View Full Code Here

TOP

Related Classes of org.bukkit.configuration.file.YamlConfiguration

Copyright © 2018 www.massapicom. 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.