package com.volumetricpixels.vitals;

import org.spout.api.command.annotated.AnnotatedCommandRegistrationFactory;
import org.spout.api.command.annotated.SimpleInjector;
import org.spout.api.plugin.CommonPlugin;

import com.volumetricpixels.vitals.commands.AdminCommands;
import com.volumetricpixels.vitals.commands.ChatCommands;
import com.volumetricpixels.vitals.commands.FunCommands;
import com.volumetricpixels.vitals.commands.GeneralCommands;
import com.volumetricpixels.vitals.commands.ProtectionCommands;
import com.volumetricpixels.vitals.commands.WorldCommands;
import com.volumetricpixels.vitals.configuration.VitalsConfiguration;

public class VitalsPlugin extends CommonPlugin {

    private VitalsConfiguration config;

    @Override
    public void onEnable() {
        config = new VitalsConfiguration(getDataFolder());

        // Register commands.
        AnnotatedCommandRegistrationFactory commandRegistration = new AnnotatedCommandRegistrationFactory(new SimpleInjector(this));

        if (VitalsConfiguration.ENABLE_PROTECTIONS.getBoolean(true)) {
            getEngine().getRootCommand().addSubCommands(this, ProtectionCommands.class, commandRegistration);
        }

        if (VitalsConfiguration.ENABLE_WORLD_MANAGEMENT.getBoolean(true)) {
            getEngine().getRootCommand().addSubCommands(this, WorldCommands.class, commandRegistration);
        }

        if (VitalsConfiguration.ENABLE_FUN_COMMANDS.getBoolean(true)) {
            getEngine().getRootCommand().addSubCommands(this, FunCommands.class, commandRegistration);
        }

        if (VitalsConfiguration.ENABLE_CHAT_COMMANDS.getBoolean(true)) {
        	getEngine().getRootCommand().addSubCommands(this, ChatCommands.class, commandRegistration);
        }
        
        if (VitalsConfiguration.ENABLE_ADMIN_COMMANDS.getBoolean(true)) {
        	getEngine().getRootCommand().addSubCommands(this, AdminCommands.class, commandRegistration);
        }
        
        if (VitalsConfiguration.ENABLE_GENERAL_COMMANDS.getBoolean(true)) {
        	getEngine().getRootCommand().addSubCommands(this, GeneralCommands.class, commandRegistration);
        }

        //Log the plugin enabling
        getLogger().info("[Vitals] v" + getDescription().getVersion() + " enabled!");
    }

    @Override
    public void onDisable() {
    	//Log the plugin disabling
        getLogger().info("[Vitals] v" + getDescription().getVersion() + " disabled!");
    }

    public VitalsConfiguration getConfig() {
        return config;
    }

}
@@ -162,16 +162,71 @@
 jector;%0A
+import org.spout.api.exception.ConfigurationException;%0A
 import o
@@ -881,16 +881,188 @@
 lder());
+%0A        config.setWritesDefaults(true);%0A%0A        try %7B%0A            config.load();%0A        %7D catch (ConfigurationException ex) %7B%0A            ex.printStackTrace();%0A        %7D
 %0A%0A      
@@ -1065,17 +1065,16 @@
       //
- 
 Register
@@ -1082,17 +1082,16 @@
 commands
-.
 %0A       
@@ -1967,32 +1967,24 @@
 ;%0A        %7D%0A
-        
 %0A        if 
@@ -2158,24 +2158,16 @@
       %7D%0A
-        
 %0A       
@@ -2525,17 +2525,20 @@
 ) %7B%0A    
-%09
+    
 //Log th
@@ -2634,32 +2634,164 @@
 + %22 disabled!%22);
+%0A%0A        try %7B%0A            config.save();%0A        %7D catch (ConfigurationException ex) %7B%0A            ex.printStackTrace();%0A        %7D
 %0A    %7D%0A%0A    publ

Make config load and save properly,