Jump to content

Change the property of a configuration file


Recommended Posts

I would try something like this (it's not tested!):


and then save it:


mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

Link to comment
Share on other sites

  • 3 weeks later...

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

		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.

Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.