コード例 #1
0
 @Override
 public void onDisable() {
   epc.writeConfig();
   clc.writeConfig();
   if (ml.moduleList.contains("ThunderRanks")) {
     ConfigManager.save(this, "exp_pools.yml");
     Bukkit.getScheduler().cancelTasks(this);
   }
   if (ml.moduleList.contains("ThunderAbilities")) ConfigManager.save(this, "chaos_lords.yml");
   getLogger().info("Successfully Disabled");
 }
コード例 #2
0
  private void setupConfigs() {
    File modulesFile = new File(this.getDataFolder(), "modules.yml");
    if (!modulesFile.exists()) {
      ConfigManager.load(this, "modules.yml");
      ml = new ModuleLoader();
      mc.writeConfig();
      ConfigManager.save(this, "modules.yml");
      ml.checkModules();
    } else {
      ml = new ModuleLoader();
      ConfigManager.load(this, "modules.yml");
      ml.checkModules();
    }

    if (ml.moduleList.contains("ThunderRanks")) {
      File exp_poolsFile = new File(this.getDataFolder(), "exp_pools.yml");
      if (!exp_poolsFile.exists()) {
        ConfigManager.load(this, "exp_pools.yml");
        epc = new ExpPoolConfig();
        epc.writeConfig();
        ConfigManager.save(this, "exp_pools.yml");

      } else {
        epc = new ExpPoolConfig();
        ConfigManager.load(this, "exp_pools.yml");

        for (String key :
            ConfigManager.get("exp_pools.yml").getConfigurationSection("pool").getKeys(false)) {
          ExpPool.expPool.put(key, ConfigManager.get("exp_pools.yml").getInt("pool." + key));
        }
      }

      File mob_expFile = new File(this.getDataFolder(), "mob_exp.yml");
      if (!mob_expFile.exists()) {
        ConfigManager.load(this, "mob_exp.yml");
        mec = new MobExpConfig();
        mec.writeConfig();
        ConfigManager.save(this, "mob_exp.yml");
      } else {
        mec = new MobExpConfig();
        ConfigManager.load(this, "mob_exp.yml");
      }
    }

    if (ml.moduleList.contains("ThunderAbilities")) {
      File chaos_lordsFile = new File(this.getDataFolder(), "chaos_lords.yml");
      if (!chaos_lordsFile.exists()) {
        ConfigManager.load(this, "chaos_lords.yml");
        clc = new ChaosLordsConfig();
        clc.writeConfig();
        ConfigManager.save(this, "chaos_lords.yml");

      } else {
        clc = new ChaosLordsConfig();
        ConfigManager.load(this, "chaos_lords.yml");

        for (String key : ConfigManager.get("chaos_lords.yml").getKeys(false)) {
          AltarListener.chaosLords.put(key, ConfigManager.get("chaos_lords.yml").getString(key));
        }
      }
    }

    if (ml.moduleList.contains("ThunderAdmin")) {
      File command_blackList = new File(this.getDataFolder(), "command_blacklist.yml");
      if (!command_blackList.exists()) {
        ConfigManager.load(this, "command_blacklist.yml");
        cbl = new CommandBlackList();
        cbl.writeConfig();
        ConfigManager.save(this, "command_blacklist.yml");
      } else {
        cbl = new CommandBlackList();
        ConfigManager.load(this, "command_blacklist.yml");
      }
    }
  }