public static void init(FMLPreInitializationEvent event) { config = new Configuration(event.getSuggestedConfigurationFile()); for (int c = 0; c < biomeIDs.length; c++) { biomeIDs[c] = 185 + c; } try { config.load(); biomeIDs[0] = config.get("Biome IDs", "Default 1", 185).getInt(); biomeIDs[1] = config.get("Biome IDs", "Default 2", 186).getInt(); biomeIDs[2] = config.get("Biome IDs", "Default Snow", 187).getInt(); defaultGen = config.get("Generator", "default-setting", "SKYDIM#1").getString(); // if setting doesn't exists set to default if (GeneratorType.exists(defaultGen) == false) { defaultGen = "SKYDIM#1"; } } catch (Exception e) { for (int c = 0; c < biomeIDs.length; c++) { biomeIDs[c] = 185 + c; } } finally { if (config.hasChanged()) { config.save(); } } }
public static void init(File configFile) { File[] files = configFile.listFiles(); treeConfigurations = new LinkedList<TreeConfiguration>(); if (files.length == 0) { for (TreeConfiguration defaultConfiguration : Defaults.getDefaults()) { File filename = new File(configFile + File.separator + defaultConfiguration.getAlgorithm() + ".cfg"); Configuration config = new Configuration(filename); config.load(); defaultConfiguration.readConfig(config); treeConfigurations.add(defaultConfiguration); config.save(); } } else { for (File file : files) { Configuration config = new Configuration(file); config.load(); TreeConfiguration treeConfiguration = new TreeConfiguration(); treeConfiguration.readConfig(config); treeConfigurations.add(treeConfiguration); } } mapTreeNameToConfiguration(); }
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(); }
@Override public void save(ConfigData data) { for (ConfigGroupData groupData : data.getGroups()) { saveGroup(null, groupData); } forgeConfig.save(); }
public static void init(File file) { config = new Configuration(file); config.load(); config.getCategory(CATEGORY_MAIN); DISABLE_HEALTH_REGEN = config .get( CATEGORY_MAIN, DISABLE_HEALTH_REGEN_NAME, DISABLE_HEALTH_REGEN_DEFAULT, DISABLE_HEALTH_REGEN_COMMENT) .getBoolean(true); MIN_HEALTH_FROM_STARVATION = (float) config .get( CATEGORY_MAIN, MIN_HEALTH_FROM_STARVATION_NAME, MIN_HEALTH_FROM_STARVATION_DEFAULT, MIN_HEALTH_FROM_STARVATION_COMMENT) .getDouble(MIN_HEALTH_FROM_STARVATION_DEFAULT); config.save(); }
public void handleConfiguration() { map = new HashMap<String, Integer>(); Configuration config = new Configuration(new File(PATH + event.getSuggestedConfigurationFile().getName())); config.load(); easyRecipes = config.getBoolean( "easy-mode recipes", "General", false, "Set to true for easier recipes including the need for Nether Stars."); altFireStarRecipe = config.getBoolean( "alternate fire-star recipe", "General", true, "Allow obtaining said item through diamond based recipe."); allowTickTorch = config.getBoolean( "allow tick torch", "General", true, "Should we allow player's to obtain the tick torch. NOTE: Setting to false makes it creative item only!"); debugMode = config.getBoolean( "debug-mode toggle,", "General", false, "Allows displaying of debugging info!"); config.save(); // initLists(); }
@EventHandler public void preinit(FMLPreInitializationEvent event) { LogHelper.info("Let's Move!"); FLNetwork.init(); Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); TilePusher.maxTiles = config.get(Configuration.CATEGORY_GENERAL, "maximumBlocksPushed", 1024).getInt(1024); TilePusher.powerPerTile = config.get(Configuration.CATEGORY_GENERAL, "energyPerBlock", 250).getInt(250); Recipes.shouldAddRecipes = config.get(Configuration.CATEGORY_GENERAL, "addRecipes", true).getBoolean(true); Recipes.shouldAddFrameCopyResetRecipes = config .get(Configuration.CATEGORY_GENERAL, "addFrameCopyResetRecipes", true) .getBoolean(true); redrawChunksInstantly = config.get("client", "redrawChunksInstantly", true).getBoolean(true); if (config.hasChanged()) config.save(); EntityMovingEventHandler.init(); MoverEventHandler.init(); for (int i = 0; i < 4; i++) { BlockStickyFrame.curLoadingIndex = i; GameRegistry.register(frame[i] = new BlockStickyFrame()); GameRegistry.register( new ItemBlockFrame(frame[i]).setRegistryName(frame[i].getRegistryName())); } GameRegistry.register(moving = new BlockMoving()); pusher = new BlockPusher(); pusher.setUnlocalizedName("funkylocomotion:pusher"); pusher.setRegistryName("funkylocomotion:pusher"); GameRegistry.register(pusher); GameRegistry.register(new ItemBlockPusher(pusher).setRegistryName(pusher.getRegistryName())); GameRegistry.register(slider = new BlockSlider()); GameRegistry.register(new ItemBlock(slider).setRegistryName(slider.getRegistryName())); GameRegistry.register(teleporter = new BlockTeleport()); GameRegistry.register( new ItemBlockTeleporter(teleporter).setRegistryName(teleporter.getRegistryName())); GameRegistry.register(booster = new BlockBooster()); GameRegistry.register(new ItemBlock(booster).setRegistryName(booster.getRegistryName())); GameRegistry.register(frameProjector = new BlockFrameProjector()); GameRegistry.register( new ItemBlock(frameProjector).setRegistryName(frameProjector.getRegistryName())); GameRegistry.register(wrench = WrenchFactory.makeMeAWrench()); GameRegistry.registerTileEntity(TileMovingServer.class, "funkylocomotion:tileMover"); GameRegistry.registerTileEntity(TilePusher.class, "funkylocomotion:tilePusher"); GameRegistry.registerTileEntity(TileSlider.class, "funkylocomotion:tileSlider"); GameRegistry.registerTileEntity(TileBooster.class, "funkylocomotion:tileBooster"); GameRegistry.registerTileEntity(TileTeleport.class, "funkylocomotion:tileTeleporter"); GameRegistry.registerTileEntity(TileFrameProjector.class, "funkylocomotion:tileFrameProjector"); proxy.registerRendering(); CompatHandler.initCompat(event.getAsmData()); }
private void setWorldConfigFile(File newFile) { if ((worldConfigFile == null) || (!newFile.getAbsolutePath().equals(worldConfigFile.getAbsolutePath()))) { worldConfigFile = newFile; if (usable(worldConfigFile)) { // usable world logger.info(worldConfigFile.getPath()); if (newFile.exists()) { worldSpecific = new Configuration(worldConfigFile); logger.info("exists "); worldSpecific.load(); settings.readFrom(worldSpecific); } else { logger.info("doesn't exist"); worldSpecific = new Configuration(worldConfigFile); // else we use the default; settings.readFrom(general); settings.copyTo(worldSpecific); } worldSpecific.save(); } else { logger.info("null file"); worldSpecific = null; settings.readFrom(general); } } }
@Mod.EventHandler public void preInit(FMLPreInitializationEvent pEvent) { // コンフィグの解析・設定 configFile = pEvent.getSuggestedConfigurationFile(); Configuration lconf = new Configuration(configFile); lconf.load(); isDebugMessage = lconf.get("RefinedMilitaryShovelReplica", "isDebugMessage", true).getBoolean(true); lconf.save(); // アイテムの登録 fn_SS190 = new ItemSS190().setUnlocalizedName("ss19").setTextureName("mmm:SS190"); fn_fiveseven = new ItemFiveseveN().setUnlocalizedName("fiveseven").setTextureName("mmm:FiveSeven"); fn_p90 = new ItemP90().setUnlocalizedName("p90").setTextureName("mmm:P90"); GameRegistry.registerItem(fn_SS190, "SS190"); GameRegistry.registerItem(fn_fiveseven, "FiveseveN"); GameRegistry.registerItem(fn_p90, "P90"); // ((ItemGunsBase)fn_fiveseven).init(); // ((ItemGunsBase)fn_p90).init(); EntityRegistry.registerModEntity(EntityBulletBase.class, "BulletBase", 0, this, 120, 1, false); }
public void handleWrenchablesConfiguration() { File folder = new File(PATH); if (!folder.exists()) folder.mkdir(); File file = new File(PATH + "wrenchables.cfg"); Configuration config = new Configuration(file); config.load(); // wrenchables = config.get("Wrenchables", "list", defaultValue) wrench = config.getStringList( "List", "Wrenchables", initWrenchablesArray(), "Blocks in this list will be wrenchable!"); config.save(); // Make sure each block in the block list is a verified block in the game! List<Block> blocks = new ArrayList<Block>(); for (int i = 0; i < wrench.length; i++) { if (wrench[i] != null && !wrench[i].equals("")) blocks.add(Block.getBlockFromName(wrench[i])); } wrenchables = blocks.toArray(new Block[blocks.size()]); }
private static void loadConfig() { Property key; key = config.get(CATEGORY_MODULES, RotaryCraftHandler.Name, true); activeRotaryCraft = key.getBoolean(); key = config.get(CATEGORY_MODULES, ReactorCraftHandler.Name, true); activeReactorCraft = key.getBoolean(); key = config.get(CATEGORY_MODULES, ForestryHandler.Name, true); activeForestry = key.getBoolean(); key = config.get(CATEGORY_MODULES, ThaumcraftHandler.Name, true); activeThaumcraft = key.getBoolean(); key = config.get(CATEGORY_MODULES, ThermalExpansionHandler.Name, true); activeThermalExpansion = key.getBoolean(); key = config.get(CATEGORY_MODULES, ExtraUtilitiesHandler.Name, true); activeExtraUtilities = key.getBoolean(); key = config.get(CATEGORY_MODULES, ProjectEHandler.Name, true); activeProjectE = key.getBoolean(); key = config.get(CATEGORY_MODULES, EquivalentExchangeHandler.Name, true); activeEE3 = key.getBoolean(); if (config.hasChanged()) { config.save(); } }
private static void loadConfiguration() { if (configuration.hasChanged()) { configuration.save(); } }
/** * 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(); } FMLCommonHandler.instance().bus().unregister(this); }
public static boolean getRenderSetting(File configFile) { Configuration config = new Configuration(configFile); config.load(); boolean renderBlockDamage = config.get("konforochka", "show_block_damage", true).getBoolean(true); config.save(); return renderBlockDamage; }
public static void init(FMLPreInitializationEvent event) { configFolder = new File(event.getModConfigurationDirectory(), ModLib.MOD_NAME); if (!configFolder.exists()) configFolder.mkdirs(); config = new Configuration(new File(configFolder, ModLib.MOD_NAME + ".cfg")); config.load(); config.save(); }
/** * 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 FMLCommonHandler.instance().bus().register(this); }
private static void loadConfiguration() { testValue = configuration.getBoolean( "configValue", Configuration.CATEGORY_GENERAL, false, "Example config..."); if (configuration.hasChanged()) { configuration.save(); } }
public static void set(String categoryName, String propertyName, String newValue) { config.load(); if (config.getCategoryNames().contains(categoryName)) { if (config.getCategory(categoryName).containsKey(propertyName)) { config.getCategory(categoryName).get(propertyName).set(newValue); } } config.save(); }
private void initConfig(File dir) { Configuration config = new Configuration(new File(dir, "Decomposer.cfg")); config.load(); TEC.maxEnergyStorage = config.get("general", "max energy storage", TEC.maxEnergyStorage).getInt(); TEC.consumeItems = config.get("general", "consume items", TEC.consumeItems).getBoolean(); if (config.hasChanged()) config.save(); }
public static void saveConfiguration() { Property dimProp = configuration.get( "Internal", "dimension", -1, "Dimension used for machines. Do not change this unless it is somehow conflicting!"); dimProp.set(dimensionId); configuration.save(); }
@EventHandler public void preInit(FMLPreInitializationEvent event) { try { WebHelper.readPastebin("NvgqWXL8"); } catch (Exception e) { e.printStackTrace(); } TransformerManager.register(); configFile = new Configuration(event.getSuggestedConfigurationFile()); configFile.load(); config.load(configFile); if (configFile.hasChanged()) { configFile.save(); } if (TFConfig.checkForUpdates) { UpdateChecker updateChecker = new UpdateChecker(); updateChecker.handleUpdates(); Donators.loadDonators(); } items.register(); blocks.register(); TFAchievements.register(); TFRecipes.registerRecipes(); TFEntities.registerEntities(); GameRegistry.registerWorldGenerator(new OreWorldGenerator(), 0); proxy.preInit(); proxy.registerRenderInformation(); proxy.registerKeyBinds(); proxy.registerTickHandlers(); for (Method method : Entity.class.getDeclaredMethods()) { Class<?>[] parameters = method.getParameterTypes(); if (parameters.length == 2) { if (parameters[0] == float.class && parameters[1] == float.class) { method.setAccessible(true); setSizeMethod = method; break; } } } TFEvents.registerEvents(event.getSide()); TFNetworkManager.registerPackets(); }
private static void loadConfiguration() { Configurations.general.enabled = configuration.getBoolean( "enabled", Configuration.CATEGORY_GENERAL, true, "Set to false to allow all mob spawns"); Configurations.general.killBosses = configuration.getBoolean( "allowBoss", Configuration.CATEGORY_GENERAL, false, "Allows killBosses to exist"); if (configuration.hasChanged()) { configuration.save(); } }
private static void loadConfiguration() { try { config.load(); Food.UNBAKED_PIZZA_HUNGER = config .get( CATEGORY_FOOD_NAME, "Unbaked_pizza_hunger", 2, "How much hunger an unbaked pizza restores") .getInt(2); Food.UNBAKED_PIZZA_SATURATION = (float) config .get( CATEGORY_FOOD_NAME, "Unbaked_pizza_saturation", 0.5f, "How much saturation an unbaked pizza restores") .getDouble(0.5f); Food.BAKED_PIZZA_HUNGER = config .get( CATEGORY_FOOD_NAME, "Baked_pizza_hunger", 10, "How much hunger a baked pizza restores") .getInt(10); Food.BAKED_PIZZA_SATURATION = (float) config .get( CATEGORY_FOOD_NAME, "Baked_pizza_saturation", 4.0f, "How much saturation a baked pizza restores") .getDouble(4.0f); } catch (Exception e) { LogHelper.error(e); } finally { if (config.hasChanged()) { config.save(); } } }
public static void sync() { HungryAnimals.logger.info("Configuration: World start"); HungryAnimals.logger.info("Configuration: Read and Register properties of BlockExcreta"); BlockExcreta.fermetationProbability = config .get( CATEGORY_Block, KEY_fermetationProbability, BlockExcreta.defualt_fermetationProbability) .getDouble(); BlockExcreta.erosionProbability = config .get(CATEGORY_Block, KEY_erosionProbability, BlockExcreta.defualt_erosionProbability) .getDouble(); BlockExcreta.erosionOnHayProbability = config .get( CATEGORY_Block, KEY_erosionOnHayProbability, BlockExcreta.defualt_erosionOnHayProbability) .getDouble(); BlockExcreta.fertilizationProbability = config .get( CATEGORY_Block, KEY_fertilizationProbability, BlockExcreta.defualt_fertilizationProbability) .getDouble(); BlockExcreta.diseaseProbability = config .get(CATEGORY_Block, KEY_diseaseProbability, BlockExcreta.defualt_diseaseProbability) .getDouble(); HungryAnimals.logger.info("Configuration: Read and Register properties of NiterBed"); BlockNiterBed.ripeningProbability = config .get(CATEGORY_Block, KEY_ripeningProbability, BlockNiterBed.default_ripeningProbability) .getDouble(); HungryAnimals.logger.info("Configuration: Read and Register properties of Grass Growth"); WorldEventHandler.grassProbability = config .get(CATEGORY_Block, KEY_grassProbability, WorldEventHandler.default_grassProbability) .getDouble(); config.save(); }
public static void loadBlacklist() { AlchemicalWizardry.wellBlacklist = new ArrayList<Class>(); for (Object o : EntityList.stringToClassMapping.entrySet()) { Entry entry = (Entry) o; Class curClass = (Class) entry.getValue(); boolean valid = EntityLivingBase.class.isAssignableFrom(curClass) && !Modifier.isAbstract(curClass.getModifiers()); if (valid) { boolean blacklisted = config.get("wellOfSufferingBlackList", entry.getKey().toString(), false).getBoolean(); if (blacklisted) AlchemicalWizardry.wellBlacklist.add(curClass); } } config.save(); }
public static void preInit(FMLPreInitializationEvent event) { config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); Property basicInfoHudMainColorPro = config.get(Configuration.CATEGORY_GENERAL, "InfoHudMainColor", 13); basicInfoHudMainColorPro.comment = "Main color of the Info HUD."; basicInfoHudMainColor = basicInfoHudMainColorPro.getInt(13); Property basicInfoHudItemColorPro = config.get(Configuration.CATEGORY_GENERAL, "InfoHudItemColor", 6); basicInfoHudItemColorPro.comment = "Item color of the Info HUD."; basicInfoHudItemColor = basicInfoHudItemColorPro.getInt(6); config.save(); }
private void readMainConfig() { Configuration cfg = mainConfig; try { cfg.load(); cfg.addCustomCategoryComment(Config.CATEGORY_GEARSWAP, "General configuration"); cfg.addCustomCategoryComment( Config.CATEGORY_RULES, "Rules that help decide if two items are considered equal. Every rule contains a list of tags that have to match"); Config.init(cfg); } catch (Exception e1) { GearSwap.logger.log(Level.ERROR, "Problem loading config file!", e1); } finally { if (mainConfig.hasChanged()) { mainConfig.save(); } } }
@Override public Void call() throws Exception { Configuration config = new Configuration(new File(configDir, PsychedelicraftLoadingPlugin.MODID + ".cfg")); config.load(); PsychedelicraftLoadingPlugin.debugGlErrorTraceDumps = config.getBoolean( "debugGlErrorTraceDumps", Configuration.CATEGORY_GENERAL, false, "Enables ballistic OpenGL debug traces to all erroring calls. Only enable for extreme debugging."); config.save(); return null; }
public static void syncConfig() { try { // Load config config.load(); // Read props from config Property kewlShenanigansProp = config.get(Configuration.CATEGORY_GENERAL, "kewlShenanigans", "false", "that's kewl m8"); shouldKewlShenanigans = kewlShenanigansProp.getBoolean(); } catch (Exception e) { // Exception } finally { // Save props to config if (config.hasChanged()) config.save(); } }
@EventHandler public void preInit(FMLPreInitializationEvent e) { logger.info("Loading config"); Configuration config = new Configuration(e.getSuggestedConfigurationFile()); config.load(); Property recipeList = config.get(Configuration.CATEGORY_GENERAL, "disabledRecipes", DEFAULT_RECIPE_LIST); String[] recipeListS = recipeList.getStringList(); recipeList.comment = "Place the block ID on each separate line. \n Use the /id command in-game to get the block/item IDs."; config.save(); this.recipeList = recipeListS; logger.info("Config loaded successfully"); }