Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.jack.jackmod.handler;
- import com.jack.jackmod.reference.Reference;
- import cpw.mods.fml.client.event.ConfigChangedEvent;
- import cpw.mods.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.common.config.Configuration;
- import java.io.File;
- public class ConfigurationHandler {
- public static Configuration configuration;
- public static boolean testValue = false;
- public static void init(File configFile) {
- // Create the config object from the given config file.
- if(configuration == null) configuration = new Configuration(configFile);
- }
- @SubscribeEvent
- public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
- if(event.modID.equalsIgnoreCase(Reference.MOD_ID)) {
- // Re-sync the configs.
- loadConfiguration();
- }
- }
- public void loadConfiguration() {
- testValue = configuration.getBoolean("configValue", Configuration.CATEGORY_GENERAL, false, "This is a test value.");
- if(configuration.hasChanged()) configuration.save();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment