Jump to content

[1.8]Make booleans stay after quitting Minecraft


Trusak

Recommended Posts

You somehow managed to create a

Configuration

object which's file is null. Since your code is all over the place and you only ever post tiny snippets of it (and I am not going back through 4 pages, no thanks) I do not know where you initialize

Clean.Coins.CC.config1

.

public static Configuration config1= new Configuration();
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{

	Configuration config1= new Configuration(event.getSuggestedConfigurationFile());
	config1.load();
	FastExamples.NotResetVariables.PMs = config1.get("Booleans", "PMs", false).getBoolean();
	FastExamples.NotResetVariables.instantRejoin = config1.get("Booleans", "InstantRejoin", false).getBoolean();
	FastExamples.NotResetVariables.showPartyChat = config1.get("Booleans", "PartyChat", false).getBoolean();
	FastExamples.NotResetVariables.showGuildChat = config1.get("Booleans", "GuildChat", false).getBoolean();
	config1.save();
	proxy.registerClientStuff();
}

Link to comment
Share on other sites

  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

You initialize the

config1

field to a new, empty

Configuration

object and then don't touch it again. What did you expect?

 

And no, you are not touching the field in

preInit

. Look closely.

How to fix that? If I understood that right, I should create the booleans in the config first. Like that:

Property PMs = config1.get("Booleans", "PMs", false);

?

Link to comment
Share on other sites

You initialize the

config1

field to a new, empty

Configuration

object and then don't touch it again. What did you expect?

 

And no, you are not touching the field in

preInit

. Look closely.

and you asked how to fix it

What is different between your and my code?

Link to comment
Share on other sites

yours

public static Configuration config1= new Configuration();
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	Configuration config1= new Configuration(event.getSuggestedConfigurationFile());
}

mine

public static Configuration config;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{	
	config = new Configuration(event.getSuggestedConfigurationFile());
}

spot the difference

Link to comment
Share on other sites

yours

public static Configuration config1= new Configuration();
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	Configuration config1= new Configuration(event.getSuggestedConfigurationFile());
}

mine

public static Configuration config;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{	
	config = new Configuration(event.getSuggestedConfigurationFile());
}

spot the difference

Oh well, didn't expect that to be the problem, thanks!
Link to comment
Share on other sites

Oh well, didn't expect that to be the problem, thanks!

 

Because it's only in Local Scope.

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

Please learn Java... Please.

That is what I am trying to do! ^^ One more quick question, is it possible to replace a word in a String with a ChatCode? I tried to do

prop = prop.replace("&a", EnumChatFormatting.GREEN);

and

prop = prop.replace("&a", "§a");

, but the first one isn't working and the second one seems to only work with the Client from Eclipse, not the regular one (Why though?). I am so sorry for being annoying!

Link to comment
Share on other sites

That is what I am trying to do! ^^

 

Modder Support

This is the support section for those modding with Forge. Help with modding goes in here, however, please keep in mind that this is not a Java school. You are expected to have basic knowledge of Java before posting here.

 

Emphasis on "You are expected to have basic knowledge of Java before posting here."

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

That is what I am trying to do! ^^

 

Modder Support

This is the support section for those modding with Forge. Help with modding goes in here, however, please keep in mind that this is not a Java school. You are expected to have basic knowledge of Java before posting here.

 

Emphasis on "You are expected to have basic knowledge of Java before posting here."

Ye sorry, I will stop asking questions on this forum but can you help me with the last question?
Link to comment
Share on other sites

Your file isn't saved in UTF-8 format.

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.

Guest
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.

Announcements




×
×
  • Create New...

Important Information

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