Guest User

Untitled

a guest
Aug 7th, 2014
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package com.jack.jackmod.handler;
  2.  
  3. import com.jack.jackmod.reference.Reference;
  4. import cpw.mods.fml.client.event.ConfigChangedEvent;
  5. import cpw.mods.fml.common.eventhandler.SubscribeEvent;
  6. import net.minecraftforge.common.config.Configuration;
  7.  
  8. import java.io.File;
  9.  
  10. public class ConfigurationHandler {
  11.  
  12. public static Configuration configuration;
  13. public static boolean testValue = false;
  14.  
  15. public static void init(File configFile) {
  16.  
  17. // Create the config object from the given config file.
  18. if(configuration == null) configuration = new Configuration(configFile);
  19.  
  20. }
  21.  
  22. @SubscribeEvent
  23. public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
  24.  
  25. if(event.modID.equalsIgnoreCase(Reference.MOD_ID)) {
  26. // Re-sync the configs.
  27. loadConfiguration();
  28. }
  29.  
  30. }
  31.  
  32.  
  33. public void loadConfiguration() {
  34. testValue = configuration.getBoolean("configValue", Configuration.CATEGORY_GENERAL, false, "This is a test value.");
  35.  
  36. if(configuration.hasChanged()) configuration.save();
  37.  
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment