Posted October 6, 201312 yr So, I am in the process of working on an ID auto assigner for my mod. However, I want to be able to change a value of the configuration file through code. Example: I want to be able to change this configuration property "autoAssign=true" to "autoAssign=false" http://i.imgur.com/gWwyMMO.jpg[/img]
October 9, 201312 yr I would try something like this (it's not tested!): config.getCategory(Configuration.CATEGORY_GENERAL).get("autoAssign").set(false); and then save it: config.save(); mnn.getNativeLang() != English If I helped you please click on the "thank you" button.
October 29, 201311 yr I would just like to report that mnn's solution works. He got the config syntax wrong, but there is a set method that works for most data types. I wanted to read in an integer array, then sort it, in order to take advantage of reading this array later in a fast method. So I figured I might as well sort the array and save it back to the config. Here's the solution: int[] white = config.get("WorldGen","dimensionWhitelistList", new int[] {0}).getIntList(); //read the values, supplying defaults int[] black = config.get("WorldGen","dimensionBlacklistList", new int[] {-1,1}).getIntList(); Arrays.sort(white); //sort Arrays.sort(black); String a=Arrays.toString(white); String whitestring[]=a.substring(1,a.length()-1).split(", "); //have to convert to a string array in order to write String b=Arrays.toString(black); String blackstring[]=b.substring(1,b.length()-1).split(", "); config.get("WorldGen","dimensionWhitelistList", new int[] {0}).set(whitestring); //default values here are irrelevant, but required in order to retrieve the config Property config.get("WorldGen","dimensionBlacklistList", new int[] {-1,1}).set(blackstring); Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.