コード例 #1
0
  // this is designed so it will work for any class.
  public FEConfig() {
    OutputHandler.SOP("Loading configs");
    config = new Configuration(FECONFIG, true);
    // config.load -- Configurations are loaded on Construction.

    // load the modules
    loadModules();
    loadCore();
    loadCmd();
    loadPerms();

    // CONFIG TESTING!!!!
    /*
     * config.addCustomCategoryComment("TEST", "this is for testing...");
     * config.addCustomCategoryComment("TEST.nestedTEST", "MORE TESTING!!!");
     * config.get("TEST", "test1", false);
     * config.get("TEST", "test2", false);
     * config.get("TEST", "test3", false);
     * config.get("TEST.nestedTEST", "test1", false);
     * config.get("TEST.nestedTEST", "test2", false);
     * config.get("TEST.nestedTEST", "test3", false);
     * config.get("TEST", "testList", new String[] {"lala", "lala", "lala"});
     * config.get("TEST.nestedTEST", "testList", new String[] {"lala", "lala", "lala"});
     */

    // Finish init and save.
    config.save();
  }
コード例 #2
0
ファイル: Metrics.java プロジェクト: Timethor/TerraControl
 /**
  * Disables metrics for the server by setting "opt-out" to true in the config file and canceling
  * the metrics task.
  *
  * @throws java.io.IOException
  */
 public void disable() throws IOException {
   // Check if the server owner has already set opt-out, if not, set it.
   if (!isOptOut()) {
     configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("true");
     configuration.save();
   }
 }
コード例 #3
0
ファイル: RCXF.java プロジェクト: Eragonn1490/Reactioncraft
  @PreInit
  public void preInit(FMLPreInitializationEvent evt) {
    // This is new! put stuff here that you want to happen before the mods are loaded
    Configuration config = new Configuration(evt.getSuggestedConfigurationFile());

    config.load();

    // Block Ids 3041 - 3060
    stonewallID = config.getBlock("Cobblestone Wall", 3041).getInt();
    stonebrickwallID = config.getBlock("Stonebrick Wall", 3042).getInt();
    crackedbrickwallID = config.getBlock("Cracked Stonebrick Wall", 3043).getInt();
    mossbrickwallID = config.getBlock("Mossy Stonebrick Wall", 3044).getInt();
    brickwallID = config.getBlock("Brick Wall", 3045).getInt();
    LapiswallID = config.getBlock("Lapis Wall", 3046).getInt();
    woodenwallID = config.getBlock("Wooden Wall", 3047).getInt();
    sandstonewallID = config.getBlock("Sandstone Wall", 3048).getInt();
    Stonebrick1ID = config.getBlock("Used for Texture 1", 3049).getInt();
    Stonebrick2ID = config.getBlock("Used for Texture 2", 3050).getInt();
    Stonebrick3ID = config.getBlock("Used for Texture 3", 3051).getInt();
    Stonebrick4ID = config.getBlock("Used for Texture  4", 3052).getInt();
    netherbrickID = config.getBlock("Nether Brick Wall", 3053).getInt();
    //    	 BloodstonebrickID = config.getBlock("Bloodstone brick Wall", 3054).getInt();

    config.save();
  }
コード例 #4
0
  public void save(ArrayList<String> players) {
    // clear it.
    if (file.exists()) file.delete();

    String[] allPlayers =
        FMLCommonHandler.instance()
            .getSidedDelegate()
            .getServer()
            .getConfigurationManager()
            .getAllUsernames();

    Configuration config = new Configuration(file);

    PlayerInfo info;
    for (String name : players) {
      if (name.equalsIgnoreCase(PermissionsAPI.EntryPlayer)) {
        config.get(name, "prefix", PermissionsAPI.EPPrefix);
        config.get(name, "suffix", PermissionsAPI.EPSuffix);
        continue;
      }

      info = PlayerInfo.getPlayerInfo(name);
      config.get(name, "prefix", info.prefix == null ? "" : info.prefix);
      config.get(name, "suffix", info.suffix == null ? "" : info.suffix);
      discardInfo(info, allPlayers);
    }

    config.save();
  }
コード例 #5
0
  @Override
  public void init() {
    config = new Configuration(file, true);

    String cat = "Snooper";

    ModuleSnooper.port = config.get(cat, "port", 25565, "The query port").getInt();
    ModuleSnooper.hostname = config.get(cat, "hostname", "", "The query hostname/IP").value;

    ModuleSnooper.autoReboot =
        config
            .get(
                cat,
                "autoReload",
                true,
                "Automatically reload the query system if a fatal error occurs")
            .getBoolean(true);
    ModuleSnooper.enable =
        config.get(cat, "enable", false, "This one is obvious, don't you think?").getBoolean(false);

    for (Response response : ResponseRegistry.getAllresponses()) {
      String subCat = cat + "." + response.getName();
      response.allowed =
          config
              .get(
                  subCat,
                  "enable",
                  true,
                  "If false, this response won't be allowed on this server.")
              .getBoolean(true);
      response.readConfig(subCat, config);
    }
    config.save();
    ModuleSnooper.startQuery();
  }
コード例 #6
0
ファイル: Metrics.java プロジェクト: Timethor/TerraControl
  public Metrics(final String modname, final String modversion) throws IOException {
    if ((modname == null) || (modversion == null)) {
      throw new IllegalArgumentException("modname and modversion cannot be null");
    }

    this.modname = modname;
    this.modversion = modversion;

    // load the config
    configurationFile = getConfigFile();
    configuration = new Configuration(configurationFile);

    // Get values, and add some defaults, if needed
    configuration.get(
        Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
    guid =
        configuration
            .get(
                Configuration.CATEGORY_GENERAL,
                "guid",
                UUID.randomUUID().toString(),
                "Server unique ID")
            .getString();
    debug =
        configuration
            .get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug")
            .getBoolean(false);
    configuration.save();
  }
コード例 #7
0
  @EventHandler // used in 1.6.2
  // @PreInit    // used in 1.5.2
  public void preInit(FMLPreInitializationEvent event) {
    // Stub Method
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();

    Property comment;
    jumpLimit = config.get("Vampire Configuration", "jumpLimit", 3.0).getDouble(3.0);
    comment = config.get("Vampire Configuration", "jumpLimit", 3.0);
    comment.comment =
        "A float on how high a vampire can reach. 1 = 100days = 15blocks. Default = 3";

    singleplayerRitual =
        config.get("Vampire Configuration", "singleplayerRitual", true).getBoolean(true);
    comment = config.get("Vampire Configuration", "singleplayerRitual", true);
    comment.comment = "Can you perform the original ritual alone? Default = true";

    allowOriginals = config.get("Vampire Configuration", "allowOriginals", true).getBoolean(true);
    comment = config.get("Vampire Configuration", "allowOriginals", true);
    comment.comment =
        "Are originals even allowed? Makes singleplayerRitual worthless if false. Default = true";

    useFoodBar = config.get("Vampire Configuration", "useFoodBar", true).getBoolean(true);
    comment = config.get("Vampire Configuration", "useFoodBar", true);
    comment.comment = "Should the food bar represent blood left. Default = true";
    // boolean = config.get("Vampire Configuration", "singleplayerRitual", true).getBoolean(true);

    suffocateOnly = config.get("Vampire Configuration", "suffocateOnly", true).getBoolean(true);
    comment = config.get("Vampire Configuration", "suffocateOnly", true);
    comment.comment =
        "In order to become a vampire after being fed blood does the player turn into a vampire with any death, or does the player need to suffocate in a wall to become a vampire? Default = true";

    config.save();
  }
コード例 #8
0
  @Override
  public void forceSave() {
    String cat = "Snooper";

    config.get(cat, "port", 25565, "").value = "" + ModuleSnooper.port;
    config.get(cat, "hostname", "", "The query hostname/IP").value = ModuleSnooper.hostname;

    config.get(
                cat,
                "autoReload",
                true,
                "Automatically reload the query system if a fatal error occurs")
            .value =
        "" + ModuleSnooper.autoReboot;
    config.get(cat, "enable", false, "This one is obvious, don't you think?").value =
        "" + ModuleSnooper.enable;

    for (Response response : ResponseRegistry.getAllresponses()) {
      String subCat = cat + "." + response.getName();
      config.get(subCat, "enable", true, "If false, this response won't be allowed on this server.")
              .value =
          "" + response.allowed;
      response.writeConfig(subCat, config);
    }
    config.save();
  }
コード例 #9
0
  @Override
  public void init() {
    config = new Configuration(file, true);

    config.addCustomCategoryComment("general", "General Commands configuration.");
    config.save();
  }
コード例 #10
0
ファイル: Settings.java プロジェクト: nanakisan/ICBM
 @Deprecated
 public static void initiate() {
   CONFIGURATION.load();
   USE_FUEL =
       CONFIGURATION
           .get(Configuration.CATEGORY_GENERAL, "Use Fuel", Settings.USE_FUEL)
           .getBoolean(Settings.USE_FUEL);
   LOAD_CHUNKS =
       Settings.CONFIGURATION
           .get(Configuration.CATEGORY_GENERAL, "Allow Chunk Loading", LOAD_CHUNKS)
           .getBoolean(LOAD_CHUNKS);
   DAO_DAN_ZUI_YUAN =
       Settings.CONFIGURATION
           .get(Configuration.CATEGORY_GENERAL, "Max Missile Distance", Settings.DAO_DAN_ZUI_YUAN)
           .getInt(Settings.DAO_DAN_ZUI_YUAN);
   ANTIMATTER_SIZE =
       Settings.CONFIGURATION
           .get(Configuration.CATEGORY_GENERAL, "Antimatter Explosion Size", ANTIMATTER_SIZE)
           .getInt(ANTIMATTER_SIZE);
   DESTROY_BEDROCK =
       Settings.CONFIGURATION
           .get(Configuration.CATEGORY_GENERAL, "Antimatter Destroy Bedrock", DESTROY_BEDROCK)
           .getBoolean(DESTROY_BEDROCK);
   MAX_ROCKET_LAUCNHER_TIER =
       Settings.CONFIGURATION
           .get(
               Configuration.CATEGORY_GENERAL,
               "Limits the max missile tier for rocket launcher item",
               MAX_ROCKET_LAUCNHER_TIER)
           .getInt(MAX_ROCKET_LAUCNHER_TIER);
   CONFIGURATION.save();
 }
コード例 #11
0
  @PreInit
  public void PreInit(FMLPreInitializationEvent event) {
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());

    config.load();
    // TODO Setup File to change it!
    config.save();
  }
コード例 #12
0
  @Override
  public void save() {
    Property versionProp = null;

    get(CATEGORY_GENERAL, "version", ABO.VERSION);

    super.save();
  }
コード例 #13
0
 @PreInit
 public void preInit(FMLPreInitializationEvent event) {
   System.out.println("Initializing Chunk Analyzer " + Version());
   Configuration config = new Configuration(event.getSuggestedConfigurationFile());
   config.load();
   ChunkAnalyzerItemID = config.getBlock("ChunkAnalyzerItemID", 1200).getInt();
   config.save();
 }
コード例 #14
0
  @Override
  public void forceLoad(ICommandSender sender) {
    config.load();

    config.save();

    CommandRegistrar.commandConfigs(config);
  }
コード例 #15
0
  public static void init(File configFile) {

    configuration = new Configuration(configFile);

    try {
      configuration.load();

      /* General configs */
      ConfigurationSettings.DISPLAY_VERSION_RESULT =
          configuration
              .get(
                  CATEGORY_GENERAL,
                  ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME,
                  ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT)
              .getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT);
      ConfigurationSettings.LAST_DISCOVERED_VERSION =
          configuration
              .get(
                  CATEGORY_GENERAL,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT)
              .getString();
      ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE =
          configuration
              .get(
                  CATEGORY_GENERAL,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_DEFAULT)
              .getString();

      /* Item configs */
      ItemIds.HEART_GOLD =
          configuration
              .getItem(Strings.HEART_GOLD_NAME, ItemIds.HEART_GOLD_DEFAULT)
              .getInt(ItemIds.HEART_GOLD_DEFAULT);

      /* Block config */
      BlockIds.CHARGER =
          configuration
              .getBlock(Strings.CHARGER_NAME, BlockIds.CHARGER_DEFAULT)
              .getInt(BlockIds.CHARGER_DEFAULT);

      /* Item durability configs */
      ConfigurationSettings.HEART_GOLD_MAX_DURABILITY =
          configuration
              .get(
                  CATEGORY_DURABILITY,
                  ConfigurationSettings.HEART_GOLD_MAX_DURABILITY_CONFIGNAME,
                  ConfigurationSettings.HEART_GOLD_MAX_DURABILITY_DEFAULT)
              .getInt(ConfigurationSettings.HEART_GOLD_MAX_DURABILITY_DEFAULT);

    } catch (Exception e) {
      FMLLog.log(
          Level.SEVERE, e, Reference.MOD_NAME + " has had a problem loading its configuration");
    } finally {
      configuration.save();
    }
  }
コード例 #16
0
  @Override
  public void forceSave() {
    // TODO: may have problems..
    String path = CommandRules.rulesFile.getPath();
    path = path.replace(ModuleCommands.cmddir.getPath(), "");

    config.addCustomCategoryComment("general", "General Commands configuration.");
    config.save();
  }
コード例 #17
0
  public static void set(String categoryName, String propertyName, String newValue) {

    configuration.load();
    if (configuration.getCategoryNames().contains(categoryName)) {
      if (configuration.getCategory(categoryName).containsKey(propertyName)) {
        configuration.getCategory(categoryName).get(propertyName).set(newValue);
      }
    }
    configuration.save();
  }
コード例 #18
0
ファイル: SimpleCraft.java プロジェクト: lecogitos/SC
  @PreInit
  public void preInit(FMLPreInitializationEvent event) {
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());

    config.load();

    colorBrickBlockID = config.getBlock("colorBrickBlockID", 1555).getInt();

    config.save();
  }
コード例 #19
0
ファイル: Metrics.java プロジェクト: Timethor/TerraControl
 /**
  * Enables metrics for the server by setting "opt-out" to false in the config file and starting
  * the metrics task.
  *
  * @throws java.io.IOException
  */
 public void enable() throws IOException {
   // Check if the server owner has already set opt-out, if not, set it.
   if (isOptOut()) {
     configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("false");
     configuration.save();
   }
   // Enable Task, if it is not running
   if (task == null) {
     start();
   }
 }
コード例 #20
0
ファイル: ConfigData.java プロジェクト: mikeyloboto/minecraft
 public static void loadConf(FMLPreInitializationEvent event) {
   conf = new Configuration(event.getSuggestedConfigurationFile());
   conf.load();
   System.out.println("PumpkinHeads Mods [PumpkinAPI] - Loading Blocks Configuration");
   loadBlocksConf();
   System.out.println("PumpkinHeads Mods [PumpkinAPI] - Loading Items Configuration");
   loadItemsConf();
   System.out.println("PumpkinHeads Mods [PumpkinAPI] - Loading Other Configuration");
   loadExtraConf();
   conf.save();
   System.out.println("PumpkinHeads Mods [PumpkinAPI] - Configuration Loaded");
 }
コード例 #21
0
  @PreInit
  public void preInit(FMLPreInitializationEvent event) {
    Configuration config = new Configuration(event.getSuggestedConfigurationFile());
    config.load();

    testItemId =
        config.get(Configuration.CATEGORY_ITEM, "testItem", 500 - Reference.ITEM_ID_FIX).getInt();
    ctrlKey =
        config.get(Configuration.CATEGORY_GENERAL, "useControlKeyForGui", false).getBoolean(true);

    config.save();
  }
コード例 #22
0
  public idManager(FMLPreInitializationEvent event) {
    // idManager configuration
    idmConfigurationFile = new File(event.getModConfigurationDirectory(), "/emc/idManager.cfg");
    idmConfiguration = new Configuration(idmConfigurationFile);
    idmConfiguration.load();

    // Sub configuration
    subConfigurationFile = event.getSuggestedConfigurationFile();
    subConfiguration = new Configuration(subConfigurationFile);
    subConfiguration.load();

    // Current ID
    currentBlockID = idmConfiguration.get("idManager", "minBlockID", minBlockID + 1).getInt();
    currentItemID = idmConfiguration.get("idManager", "minItemID", minItemID + 1).getInt();
    currentBiomeID = idmConfiguration.get("idManager", "minBiomeID", minBiomeID + 1).getInt();
    currentEntityID = idmConfiguration.get("idManager", "minEntityID", minEntityID + 1).getInt();
    currentFoodID = idmConfiguration.get("idManager", "minFoodID", minFoodID + 1).getInt(2020);

    // Save configuration
    idmConfiguration.save();
    subConfiguration.save();
  }
コード例 #23
0
  @Override
  public final void loadFromConfigs(Configuration config, String category) throws Exception {
    Property prop;

    String cat = category.substring(0, category.lastIndexOf('.'));

    prop = config.get(cat, "useFEDataDir", false);
    prop.comment =
        "Set to true to use the '.minecraft/ForgeEssentials/saves' directory instead of a world. Server owners may wish to set this to true.";

    useFEBase = prop.getBoolean(false);

    config.save();
  }
コード例 #24
0
ファイル: Core.java プロジェクト: KodeKishin/ME-Craft
 @Mod.PreInit
 public static void preInit(FMLPreInitializationEvent event) {
   // Config(Ayarlar)
   Configuration config = new Configuration(event.getSuggestedConfigurationFile());
   config.load();
   ItemID = config.get("Item:", "Base Item ID", 2789).getInt();
   BlockID = config.get("Block:", "Base Block ID", 901).getInt();
   x1 = config.get("Block:", "Pressure Machine Idle ID", 901 + 34).getInt();
   x2 = config.get("Block:", "Pressure Machine Runing ID", 901 + 35).getInt();
   BiomeBlockID = config.get("Biome:", "Biome Block ID", 250).getInt();
   BiomeID = config.get("Biome:", "Biome ID", 23).getInt();
   AchievementID = config.get("Achievement:", "Base Achievement ID", 2001).getInt();
   config.save();
 }
コード例 #25
0
  @Override
  public void forceSave() {
    // config.load -- Configurations are loaded on Construction.
    config.addCustomCategoryComment("Chat", "Chatconfigs");

    Property prop =
        config.get(
            "Chat",
            "chatformat",
            "%groupPrefix%playerPrefix<%username>%playerSuffix%groupSuffix %reset%message");
    prop.comment = "This String formats the Chat.";
    prop.comment +=
        "\nIf you want both a color and special formatcodes, the color needs to be first before the special code";
    prop.comment +=
        "\nExamples: '%red%username' '%red%bold%username'\nNot OK:'%bold%gold%underline%username' In this example you would get the username in gold and underline but without bold";
    prop.comment += "\nList of possible variables:";
    prop.comment +=
        "\nFor the username: %username The health of the player can be used with %health. The variable, you need for the message:%message ";
    prop.comment += "\nFor the players prefix and suffix use %playerPrefix and %playerSuffix";
    prop.comment +=
        "\nColors:%black,%darkblue,%darkgreen,%darkaqua,%darkred,%purple,%gold,%grey,%darkgrey,%indigo,\n       %green,%aqua,%red,%pink,%yellow,%white";
    prop.comment += "\nSpecial formatcodes: %random,%bold,%strike,%underline,%italics";
    prop.comment += "\nTo reset all formatcodes, you can use %reset";
    prop.comment +=
        "\nUse %rank to display a users rank as defined in the config below., %zone to specify there current zone";
    prop.comment +=
        "\nUse %groupPrefix and groupSuffix to display the prefix and suffix of groups as defined in the config";
    prop.value = chatFormat;

    config.get("BannedWords", "censor", true, "censor the words in the censorList").value =
        "" + Chat.censor;
    config.get("BannedWords", "censorList", new String[] {}, "List of words to be censored")
            .valueList =
        Chat.bannedWords.toArray(new String[Chat.bannedWords.size()]);

    config.addCustomCategoryComment(
        "Chat.groups",
        "You may put enything here that you want displaed as part of the group prefixes, suffixes, or ranks."
            + "\n {ladderName<:>Zone} will display the data for the highest priority group that the player is in that is part of the specified ladder and specified zone."
            + "\n {...} will display the data of each group the player is in in order of priority"
            + "\n you may put contsraints with ladders or zones with {...<:>zoneName} or {ladderName<:>...}"
            + "\n you may also use the color and MCFormat codes above.");

    config.get("Chat.groups", "groupPrefix", "").value = groupPrefixFormat;
    config.get("Chat.groups", "groupSuffix", "").value = groupSuffixFormat;
    config.get("Chat.groups", "rank", "").value = groupRankFormat;

    config.save();
  }
コード例 #26
0
  @Subscribe
  public void preInit(FMLPreInitializationEvent ev) {
    bukkitLogger = ev.getModLog();
    bukkitLogger.setParent(FMLCommonHandler.instance().getFMLLogger());

    // ServerGUI.logger = bukkitLogger;
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {

      FMLCommonHandler.instance()
          .getFMLLogger()
          .warning("Bukkit For Vanilla is currently only a server-side mod.");
      return;
    } else if (FMLCommonHandler.instance().getEffectiveSide() == Side.BUKKIT) {
      FMLCommonHandler.instance()
          .getFMLLogger()
          .severe("The bukkit API as a forge mod on bukkit? *mind blown*");
      return;
    }
    this.bukkitLogger.info("Initializing configuration...");
    myConfigurationFile = ev.getSuggestedConfigurationFile();

    Configuration config = new Configuration(myConfigurationFile);
    config.addCustomCategoryComment("consoleConfig", "Configuration for the server console");
    config.addCustomCategoryComment("dontTouchThis", "Things which are best left untouched");

    Property colour =
        config.get(
            "consoleConfig",
            "enablecolour",
            DedicatedServer.getServer().getGuiEnabled() ? false : true);
    colour.comment = "Enable coloured ANSI console output";
    this.allowAnsi = colour.getBoolean(false);

    Property plugins = config.get(Configuration.CATEGORY_GENERAL, "pluginDir", "plugins");
    plugins.comment = "The folder to look for plugins in.";
    this.pluginFolder = plugins.value;

    Property suuid = config.get("dontTouchThis", "serverUUID", this.genUUID());
    bukkitLogger.info("Set UUID to " + suuid.value);
    suuid.comment = "The UUID of the server. Don't touch this or it might break your plugins.";
    this.serverUUID = suuid.value;

    /*Property showAllLogs = config.get(Configuration.CATEGORY_GENERAL, "printForgeLogToGui", false);
    showAllLogs.comment = "Print stuff that's outputted to the logs to the GUI as it happens.";
    this.showAllLogs = showAllLogs.getBoolean(false);*/

    config.save();
  }
コード例 #27
0
ファイル: GiantMobs.java プロジェクト: tuyapin/MinecraftMods
 @Mod.PreInit
 public void preinit(FMLPreInitializationEvent event) {
   Configuration cfgConfiguration = new Configuration(event.getSuggestedConfigurationFile());
   cfgConfiguration.load();
   giandSkeletonID =
       cfgConfiguration.get("giantskeletonid", Configuration.CATEGORY_GENERAL, 75).getInt();
   giantSpiderID =
       cfgConfiguration.get("giantspiderid", Configuration.CATEGORY_GENERAL, 76).getInt();
   giantEndermanID =
       cfgConfiguration.get("giantendermanid", Configuration.CATEGORY_GENERAL, 77).getInt();
   giantCreeperID =
       cfgConfiguration.get("giantcreeperid", Configuration.CATEGORY_GENERAL, 78).getInt();
   giantZombieID =
       cfgConfiguration.get("giantzombieid", Configuration.CATEGORY_GENERAL, 79).getInt();
   cfgConfiguration.save();
 }
コード例 #28
0
ファイル: UPermissions.java プロジェクト: Nauthul/uMods
 @PreInit
 public void preInit(FMLPreInitializationEvent event) {
   Configuration config = new Configuration(event.getSuggestedConfigurationFile());
   config.load();
   this.allowOps = config.get("Settings", "allowOps", true).getBoolean(true);
   this.createUsersRecords = config.get("Settings", "createUsersRecords", false).getBoolean(false);
   this.debug = config.get("Settings", "debug", false).getBoolean(false);
   config.save();
   this.permController = new PermissionsController();
   this.permHandler = new PermissionInvocationHandler();
   ArrayList<String> set = new ArrayList();
   for (ModContainer mod : Loader.instance().getActiveModList()) {
     if (!set.contains(mod.getSource().getAbsolutePath()))
       set.add(mod.getSource().getAbsolutePath());
   }
   for (String path : set) checkLoadedModForPermissionClass(new File(path));
 }
コード例 #29
0
  public static void init(File configFile) {

    configuration = new Configuration(configFile);

    try {
      configuration.load();

      /* General configs */
      ConfigurationSettings.DISPLAY_VERSION_RESULT =
          configuration
              .get(
                  CATEGORY_GENERAL,
                  ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME,
                  ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT)
              .getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT);
      ConfigurationSettings.LAST_DISCOVERED_VERSION =
          configuration
              .get(
                  CATEGORY_GENERAL,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT)
              .getString();
      ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE =
          configuration
              .get(
                  CATEGORY_GENERAL,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_CONFIGNAME,
                  ConfigurationSettings.LAST_DISCOVERED_VERSION_TYPE_DEFAULT)
              .getString();

      // ItemIds.MINIUM_SHARD = configuration.getItem(Strings.MINIUM_SHARD_NAME,
      // ItemIds.MINIUM_SHARD_DEFAULT).getInt(ItemIds.MINIUM_SHARD_DEFAULT);

    } catch (Exception e) {
      FMLLog.log(
          Level.SEVERE, e, CoreRef.MOD_NAME + " has had a problem loading its configuration");
    } finally {
      configuration.save();
    }
  }
コード例 #30
0
ファイル: Klaxon.java プロジェクト: Tatara88/Minecraft
 /** {@inheritDoc} */
 @PreInit
 public void preInit(FMLPreInitializationEvent event) {
   config = new Configuration(event.getSuggestedConfigurationFile());
   config.load();
   if (event.getSide() == Side.CLIENT) {
     // Creates the klaxon folder.
     klaxons = new File(event.getModConfigurationDirectory(), "klaxons");
     if (!klaxons.exists()) {
       klaxons.mkdirs();
     }
     FMLLog.log(MOD_ID, Level.INFO, "Folder %s", klaxons);
     // Loads client configuration.
     file = new File(config.get(Configuration.CATEGORY_GENERAL, "Klaxon", "").getString());
     // Loading and loaded klaxons.
     loadingKlaxons = new HashSet<String>();
     loadedKlaxons = new HashSet<String>();
   }
   // Loads shared configuration.
   klaxonId =
       config.get(Configuration.CATEGORY_ITEM, "Klaxon", klaxonDefaultId).getInt(klaxonDefaultId);
   config.save();
 }