Jump to content

Config file not saving


Recommended Posts

Hi, I am trying to write to a config file in MC 1.8.9. I type in the new value (90, previously 45), press done, and I go back in the config, and it's 45 again! Code to write to value:

public static void syncConfig() {
	    try {
	        Property configFOV = config.get(Configuration.CATEGORY_GENERAL,
	                "Amount to zoom to");

	        FOVVal = configFOV.getInt();
	    } catch (Exception error) {
	    } finally {

Code for detecting if done button is pushed:

protected void actionPerformed(GuiButton button)
        if (button.id == 2000)
            boolean flag = true;
                if ((configID != null || parentScreen == null || !(parentScreen instanceof FOVGuiConfig)) 
                        && (entryList.hasChangedEntry(true)))
                    boolean requiresMcRestart = entryList.saveConfigElements();

                    if (Loader.isModLoaded(Reference.MODID))
                        ConfigChangedEvent event = new OnConfigChangedEvent(Reference.MODID, "FOV", isWorldRunning, false);
                        if (!event.getResult().equals(Result.DENY))
                            MinecraftForge.EVENT_BUS.post(new PostConfigChangedEvent(Reference.MODID, "FOV", isWorldRunning, false));
                        if (requiresMcRestart)
                            flag = false;
                            mc.displayGuiScreen(new GuiMessageDialog(parentScreen, "fml.configgui.gameRestartTitle", 
                                    new ChatComponentText(I18n.format("fml.configgui.gameRestartRequired")), "fml.configgui.confirmRestartMessage"));
                        if (parentScreen instanceof FOVGuiConfig)
                            ((FOVGuiConfig) parentScreen).needsRefresh = true;
            catch (Throwable e)
            if (flag)

I have been working on this for hours, and any help would be appreciated greatly. Thanks!

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.