Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. public class Config {
  2.  
  3. public static Config instance = new Config();
  4. public static Configuration config;
  5. // Settings world gen
  6. public static boolean spawnFlowers = true;
  7. public static boolean spawnTin = true;
  8. public static boolean spawnCopper = true;
  9. public static boolean spawnJade = true;
  10. public static boolean spawnAmethyst = true;
  11. public static boolean spawnBasalt = true;
  12. // Setting crafting
  13. public static boolean duplicatePatterns = true;
  14.  
  15. @SubscribeEvent
  16. public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
  17. if (eventArgs.getModID().equals(Reference.modid))
  18. Config.syncConfig();
  19. }
  20.  
  21. public static void init(File file) {
  22. config = new Configuration(file);
  23. config.load();
  24. syncConfig();
  25. }
  26.  
  27. public static void syncConfig() {
  28. String worldCategory = "World Generaration";
  29. String craftingCategory = "Crafting";
  30.  
  31. config.addCustomCategoryComment(worldCategory, "World Generaration Settings");
  32. spawnFlowers = config.getBoolean("spawnFlowers", worldCategory, true,
  33. "Turns on and off flower world generation");
  34. spawnCopper = config.getBoolean("spawnCopper", worldCategory, true, "Turns on and off copper world generation");
  35. spawnTin = config.getBoolean("spawnTin", worldCategory, true, "Turns on and off tin world generation");
  36. spawnJade = config.getBoolean("spawnJade", worldCategory, true, "Turns on and off jade world generation");
  37. spawnAmethyst = config.getBoolean("spawnAmethyst", worldCategory, true,
  38. "Turns on and off amethyst world generation");
  39. spawnBasalt = config.getBoolean("spawnBasalt", worldCategory, true, "Turns on and off basalt world generation");
  40.  
  41. config.addCustomCategoryComment(craftingCategory, "Crafting Settings");
  42. duplicatePatterns = config.getBoolean("duplicatePatterns", craftingCategory, true,
  43. "Turns on and off duplication of wooden patterns, for example a wooden pattern and a wooden pattern wall crafts 2 wooden pattern walls");
  44.  
  45. config.save();
  46. }
  47.  
  48. public static void resetConfig() {
  49. spawnFlowers = true;
  50. spawnTin = true;
  51. spawnCopper = true;
  52. spawnJade = true;
  53. spawnAmethyst = true;
  54. spawnBasalt = true;
  55. duplicatePatterns = true;
  56. config.save();
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement