]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/config/ConfigManager.java
1.18.2-rc1
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / config / ConfigManager.java
1 package com.irtimaled.bbor.client.config;
2
3 import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
4 import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
5
6 import java.io.File;
7 import java.util.HashSet;
8 import java.util.Map;
9 import java.util.Objects;
10 import java.util.Set;
11
12 public class ConfigManager {
13     private static final Set<Setting<?>> settings = new HashSet<>();
14     private static File configDir;
15
16     public static Setting<Boolean> fill;
17     //    public static Setting<Boolean> drawVillages;
18 //    public static Setting<Boolean> drawDesertTemples;
19 //    public static Setting<Boolean> drawJungleTemples;
20 //    public static Setting<Boolean> drawWitchHuts;
21 //    public static Setting<Boolean> drawStrongholds;
22 //    public static Setting<Boolean> drawMineShafts;
23 //    public static Setting<Boolean> drawNetherFortresses;
24 //    public static Setting<Boolean> drawOceanMonuments;
25     public static Setting<Boolean> alwaysVisible;
26     public static Setting<Boolean> drawSlimeChunks;
27     public static Setting<Integer> slimeChunkMaxY;
28     public static Setting<Boolean> keepCacheBetweenSessions;
29     public static Setting<Boolean> drawWorldSpawn;
30     public static Setting<Integer> worldSpawnMaxY;
31     public static Setting<Boolean> drawLazySpawnChunks;
32     //    public static Setting<Boolean> drawEndCities;
33 //    public static Setting<Boolean> drawMansions;
34 //    public static Setting<Boolean> drawShipwrecks;
35 //    public static Setting<Boolean> drawOceanRuins;
36 //    public static Setting<Boolean> drawBuriedTreasure;
37 //    public static Setting<Boolean> drawIgloos;
38     public static Setting<Boolean> drawMobSpawners;
39     public static Setting<Boolean> renderMobSpawnerSpawnArea;
40     public static Setting<Boolean> renderMobSpawnerActivationLines;
41     //    public static Setting<Boolean> drawPillagerOutposts;
42     public static Setting<Boolean> outerBoxesOnly;
43     public static Setting<Boolean> drawAFKSpheres;
44     public static Setting<Boolean> renderAFKSpawnableBlocks;
45     public static Setting<Integer> afkSpawnableBlocksRenderDistance;
46     public static Setting<Boolean> drawBeacons;
47     public static Setting<Boolean> drawBiomeBorders;
48     public static Setting<Boolean> renderOnlyCurrentBiome;
49     public static Setting<Integer> biomeBordersRenderDistance;
50     public static Setting<Integer> biomeBordersMaxY;
51     //    public static Setting<Boolean> drawNetherFossils;
52 //    public static Setting<Boolean> drawBastionRemnants;
53 //    public static Setting<Boolean> drawRuinedPortals;
54     public static Setting<Boolean> drawConduits;
55     public static Setting<Boolean> renderConduitMobHarmArea;
56     public static Setting<Boolean> drawSpawnableBlocks;
57     public static Setting<Integer> spawnableBlocksRenderWidth;
58     public static Setting<Integer> spawnableBlocksRenderHeight;
59     public static Setting<Boolean> invertBoxColorPlayerInside;
60     public static Setting<Boolean> renderSphereAsDots;
61     public static Setting<Boolean> drawFlowerForests;
62     public static Setting<Integer> flowerForestsRenderDistance;
63     public static Setting<Boolean> drawBedrockCeilingBlocks;
64
65     public static Setting<HexColor> colorWorldSpawn;
66     public static Setting<HexColor> colorLazySpawnChunks;
67     public static Setting<HexColor> colorMobSpawners;
68     public static Setting<HexColor> colorMobSpawnersLineFarAway;
69     public static Setting<HexColor> colorMobSpawnersLineNearby;
70     public static Setting<HexColor> colorMobSpawnersLineActive;
71     public static Setting<HexColor> colorSlimeChunks;
72     public static Setting<HexColor> colorAFKSpheres;
73     public static Setting<HexColor> colorAFKSpheresSafeArea;
74     public static Setting<HexColor> colorBiomeBorders;
75     public static Setting<HexColor> colorBeacons;
76     public static Setting<HexColor> colorCustom;
77     public static Setting<HexColor> colorConduits;
78     public static Setting<HexColor> colorConduitMobHarmArea;
79     public static Setting<HexColor> colorSpawnableBlocks;
80 //    public static Setting<HexColor> colorJungleTemples;
81 //    public static Setting<HexColor> colorDesertTemples;
82 //    public static Setting<HexColor> colorWitchHuts;
83 //    public static Setting<HexColor> colorOceanMonuments;
84 //    public static Setting<HexColor> colorShipwrecks;
85 //    public static Setting<HexColor> colorOceanRuins;
86 //    public static Setting<HexColor> colorBuriedTreasure;
87 //    public static Setting<HexColor> colorStrongholds;
88 //    public static Setting<HexColor> colorMineShafts;
89 //    public static Setting<HexColor> colorNetherFortresses;
90 //    public static Setting<HexColor> colorEndCities;
91 //    public static Setting<HexColor> colorMansions;
92 //    public static Setting<HexColor> colorIgloos;
93 //    public static Setting<HexColor> colorPillagerOutposts;
94 //    public static Setting<HexColor> colorVillages;
95 //    public static Setting<HexColor> colorNetherFossils;
96 //    public static Setting<HexColor> colorBastionRemnants;
97 //    public static Setting<HexColor> colorRuinedPortals;
98     public static Setting<HexColor> colorFlowerForestDandelion;
99     public static Setting<HexColor> colorFlowerForestPoppy;
100     public static Setting<HexColor> colorFlowerForestAllium;
101     public static Setting<HexColor> colorFlowerForestAzureBluet;
102     public static Setting<HexColor> colorFlowerForestRedTulip;
103     public static Setting<HexColor> colorFlowerForestOrangeTulip;
104     public static Setting<HexColor> colorFlowerForestWhiteTulip;
105     public static Setting<HexColor> colorFlowerForestPinkTulip;
106     public static Setting<HexColor> colorFlowerForestOxeyeDaisy;
107     public static Setting<HexColor> colorFlowerForestCornflower;
108     public static Setting<HexColor> colorFlowerForestLilyOfTheValley;
109     public static Setting<HexColor> colorBedrockCeilingBlocks;
110
111     public static Setting<HexColor> buttonOnOverlay;
112
113     public static Setting<Integer> fastRender;
114
115     public static Map<String, Setting<Boolean>> structureRenderSettings = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
116     public static Map<String, Setting<HexColor>> structureColorSettings = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
117     private static final Map<String, HexColor> defaultStructureColors = new Object2ObjectOpenHashMap<>();
118
119     static {
120          defaultStructureColors.put("minecraft:fortress", Objects.requireNonNull(HexColor.from("#ff0000")));
121          defaultStructureColors.put("minecraft:village_desert", Objects.requireNonNull(HexColor.from("#800080")));
122          defaultStructureColors.put("minecraft:village_snowy", Objects.requireNonNull(HexColor.from("#800080")));
123          defaultStructureColors.put("minecraft:village_plains", Objects.requireNonNull(HexColor.from("#800080")));
124          defaultStructureColors.put("minecraft:village_savanna", Objects.requireNonNull(HexColor.from("#800080")));
125          defaultStructureColors.put("minecraft:village_taiga", Objects.requireNonNull(HexColor.from("#800080")));
126          defaultStructureColors.put("minecraft:desert_pyramid", Objects.requireNonNull(HexColor.from("#ffc800")));
127          defaultStructureColors.put("minecraft:swamp_hut", Objects.requireNonNull(HexColor.from("#0000ff")));
128          defaultStructureColors.put("minecraft:monument", Objects.requireNonNull(HexColor.from("#00ffff")));
129          defaultStructureColors.put("minecraft:shipwreck", Objects.requireNonNull(HexColor.from("#00ffff")));
130          defaultStructureColors.put("minecraft:shipwreck_beached", Objects.requireNonNull(HexColor.from("#00ffff")));
131          defaultStructureColors.put("minecraft:ocean_ruin_cold", Objects.requireNonNull(HexColor.from("#00ffff")));
132          defaultStructureColors.put("minecraft:ocean_ruin_warm", Objects.requireNonNull(HexColor.from("#00ffff")));
133          defaultStructureColors.put("minecraft:buried_treasure", Objects.requireNonNull(HexColor.from("#00ffff")));
134          defaultStructureColors.put("minecraft:stronghold", Objects.requireNonNull(HexColor.from("#ffff00")));
135          defaultStructureColors.put("minecraft:mineshaft", Objects.requireNonNull(HexColor.from("#c0c0c0")));
136          defaultStructureColors.put("minecraft:end_city", Objects.requireNonNull(HexColor.from("#ff00ff")));
137          defaultStructureColors.put("minecraft:mansion", Objects.requireNonNull(HexColor.from("#8b4513")));
138          defaultStructureColors.put("minecraft:igloo", Objects.requireNonNull(HexColor.from("#ffffff")));
139          defaultStructureColors.put("minecraft:pillager_outpost", Objects.requireNonNull(HexColor.from("#404040")));
140          defaultStructureColors.put("minecraft:nether_fossil", Objects.requireNonNull(HexColor.from("#ffffff")));
141          defaultStructureColors.put("minecraft:bastion_remnant", Objects.requireNonNull(HexColor.from("#c0c0c0")));
142          defaultStructureColors.put("minecraft:ruined_portal", Objects.requireNonNull(HexColor.from("#c800ff")));
143          defaultStructureColors.put("minecraft:ruined_portal_desert", Objects.requireNonNull(HexColor.from("#c800ff")));
144          defaultStructureColors.put("minecraft:ruined_portal_mountain", Objects.requireNonNull(HexColor.from("#c800ff")));
145          defaultStructureColors.put("minecraft:ruined_portal_jungle", Objects.requireNonNull(HexColor.from("#c800ff")));
146          defaultStructureColors.put("minecraft:ruined_portal_ocean", Objects.requireNonNull(HexColor.from("#c800ff")));
147          defaultStructureColors.put("minecraft:ruined_portal_swamp", Objects.requireNonNull(HexColor.from("#c800ff")));
148          defaultStructureColors.put("minecraft:ruined_portal_nether", Objects.requireNonNull(HexColor.from("#c800ff")));
149     }
150
151     private static Configuration config;
152
153     public static void loadConfig() {
154         configDir = new File(".", "config");
155         configDir.mkdirs();
156         config = loadConfiguration();
157
158         fill = setup(config, "general", "fill", true, "If set to true the bounding boxes are filled.");
159         outerBoxesOnly = setup(config, "general", "outerBoxesOnly", false, "If set to true only the outer bounding boxes are rendered.");
160         alwaysVisible = setup(config, "general", "alwaysVisible", false, "If set to true boxes will be visible even through other blocks.");
161         keepCacheBetweenSessions = setup(config, "general", "keepCacheBetweenSessions", false, "If set to true bounding box caches will be kept between sessions.");
162         invertBoxColorPlayerInside = setup(config, "general", "invertBoxColorPlayerInside", false, "If set to true the color of any bounding box the player is inside will be inverted.");
163         renderSphereAsDots = setup(config, "general", "renderSphereAsDots", false, "If set to true spheres will be rendered as dots.");
164         buttonOnOverlay = setup(config, "general", "buttonEnabledOverlay", HexColor.from("#3000ff00"), "The color and alpha of the button overlay when a button is on.");
165         fastRender = setup(config, "general", "fastRender", 2, "Fast render settings. Higher value for faster rendering. ");
166
167         drawBeacons = setup(config, "beacons", "drawBeacons", true, "If set to true beacon bounding boxes will be drawn.");
168
169         drawConduits = setup(config, "conduits", "drawConduits", true, "If set to true conduit bounding spheres will be drawn.");
170         renderConduitMobHarmArea = setup(config, "conduits", "renderConduitMobHarmArea", true, "If set to true a box to show the area where hostile mobs are harmed will be drawn");
171
172         drawBiomeBorders = setup(config, "biomeBorders", "drawBiomeBorders", true, "If set to true biome borders will be drawn.");
173         renderOnlyCurrentBiome = setup(config, "biomeBorders", "renderOnlyCurrentBiome", true, "If set to true only the biome border for the current biome will be drawn.");
174         biomeBordersRenderDistance = setup(config, "biomeBorders", "biomeBordersRenderDistance", 3, "The distance from the player where biome borders will be drawn.");
175         biomeBordersMaxY = setup(config, "biomeBorders", "biomeBordersMaxY", -1, "The maximum top of the biome borders. If set to -1 it will use the value when activated, if set to 0 it will always track the players feet.");
176
177         drawFlowerForests = setup(config, "flowerForests", "drawFlowerForests", true, "If set to true flower forest flower overlays will be drawn.");
178         flowerForestsRenderDistance = setup(config, "flowerForests", "flowerForestsRenderDistance", 3, "The distance from the player where flower forests will be drawn.");
179
180         drawBedrockCeilingBlocks = setup(config, "bedrockCeiling", "drawBedrockCeilingBlocks", true, "If set to true position with only one layer of bedrock will be drawn.");
181
182 //        drawVillages = setup(config, "structures", "drawVillages", false, "If set to true village bounding boxes will be drawn.");
183 //        drawDesertTemples = setup(config, "structures", "drawDesertTemples", true, "If set to true desert temple bounding boxes are drawn.");
184 //        drawJungleTemples = setup(config, "structures", "drawJungleTemples", true, "If set to true jungle temple bounding boxes are drawn.");
185 //        drawWitchHuts = setup(config, "structures", "drawWitchHuts", true, "If set to true witch hut bounding boxes are drawn.");
186 //        drawStrongholds = setup(config, "structures", "drawStrongholds", false, "If set to true stronghold bounding boxes are drawn.");
187 //        drawMineShafts = setup(config, "structures", "drawMineShafts", false, "If set to true mineshaft bounding boxes are drawn.");
188 //        drawNetherFortresses = setup(config, "structures", "drawNetherFortresses", true, "If set to true nether fortress bounding boxes are drawn.");
189 //        drawOceanMonuments = setup(config, "structures", "drawOceanMonuments", true, "If set to true ocean monument bounding boxes are drawn.");
190 //        drawEndCities = setup(config, "structures", "drawEndCities", true, "If set to true end city bounding boxes will be drawn.");
191 //        drawMansions = setup(config, "structures", "drawMansions", true, "If set to true woodland mansions will be drawn.");
192 //        drawIgloos = setup(config, "structures", "drawIgloos", true, "If set to true igloos will be drawn.");
193 //        drawShipwrecks = setup(config, "structures", "drawShipwrecks", true, "If set to true shipwrecks will be drawn.");
194 //        drawOceanRuins = setup(config, "structures", "drawOceanRuins", true, "If set to true ocean ruins will be drawn.");
195 //        drawBuriedTreasure = setup(config, "structures", "drawBuriedTreasures", true, "If set to true buried treasure will be drawn.");
196 //        drawPillagerOutposts = setup(config, "structures", "drawPillagerOutposts", true, "If set to true pillager outposts will be drawn.");
197 //        drawNetherFossils = setup(config, "structures", "drawNetherFossils", true, "If set to true nether fossils will be drawn.");
198 //        drawBastionRemnants = setup(config, "structures", "drawBastionRemnants", true, "If set to true bastion remnants will be drawn.");
199 //        drawRuinedPortals = setup(config, "structures", "drawRuinedPortals", true, "If set to true ruined portals will be drawn.");
200
201         drawSlimeChunks = setup(config, "slimeChunks", "drawSlimeChunks", true, "If set to true slime chunks bounding boxes are drawn.");
202         slimeChunkMaxY = setup(config, "slimeChunks", "slimeChunkMaxY", -1, "The maximum top of the slime chunk bounding box. If set to -1 it will use the value when activated, if set to 0 it will always track the player's feet.");
203
204         drawWorldSpawn = setup(config, "worldSpawn", "drawWorldSpawn", true, "If set to true world spawn and spawn chunks bounding boxes are drawn.");
205         worldSpawnMaxY = setup(config, "worldSpawn", "worldSpawnMaxY", -1, "The maximum top of the world spawn bounding boxes. If set to -1 it will use the value when activated, if set to 0 it will always track the players feet.");
206         drawLazySpawnChunks = setup(config, "worldSpawn", "drawLazySpawnChunks", false, "If set to true the lazy spawn chunks bounding boxes will be drawn.");
207
208         drawMobSpawners = setup(config, "mobSpawners", "drawMobSpawners", true, "If set to true mob spawners will be drawn.");
209         renderMobSpawnerSpawnArea = setup(config, "mobSpawners", "renderMobSpawnerSpawnArea", true, "If set to true a box to show the maximum possible spawn area (10x10x4) for a spawner will be drawn");
210         renderMobSpawnerActivationLines = setup(config, "mobSpawners", "renderMobSpawnerActivationLines", true, "If set to true a red/orange/green line will be drawn to show if the spawner is active");
211
212         drawAFKSpheres = setup(config, "afkSpot", "drawAFKSpheres", true, "If set to true afk spot spheres will be drawn.");
213         renderAFKSpawnableBlocks = setup(config, "afkSpot", "renderAFKSpawnableBlocks", true, "If set to true boxes to show spawnable blocks within the AFK sphere will be drawn.");
214         afkSpawnableBlocksRenderDistance = setup(config, "afkSpot", "afkSpawnableBlocksRenderDistance", 3, "The distance from the player where spawnable blocks within the AFK sphere will be drawn.");
215
216         drawSpawnableBlocks = setup(config, "spawnableBlocks", "drawSpawnableBlocks", false, "If set to true boxes to show spawnable blocks will be drawn.");
217         spawnableBlocksRenderWidth = setup(config, "spawnableBlocks", "spawnableBlocksRenderWidth", 2, "The distance from the player where spawnable blocks will be drawn in X and Z axis.");
218         spawnableBlocksRenderHeight = setup(config, "spawnableBlocks", "spawnableBlocksRenderHeight", 1, "The distance from the player where spawnable blocks will be drawn in Y axis.");
219
220         colorWorldSpawn = setup(config, "colors", "colorWorldSpawn", HexColor.from("#ff0000"), "Color of world spawn and spawn chunks bounding boxes.");
221         colorLazySpawnChunks = setup(config, "colors", "colorLazySpawnChunks", HexColor.from("#ff0000"), "Color of lazy spawn chunks bounding boxes.");
222         colorMobSpawners = setup(config, "colors", "colorMobSpawners", HexColor.from("#00ff00"), "Color of mob spawners.");
223         colorMobSpawnersLineFarAway = setup(config, "colors", "colorMobSpawnersLineFarAway", HexColor.from("#ff0000"), "Color of mob spawner activation line if spawner far away.");
224         colorMobSpawnersLineNearby = setup(config, "colors", "colorMobSpawnersLineNearby", HexColor.from("#ff7f00"), "Color of mob spawners activation line if spawner nearby.");
225         colorMobSpawnersLineActive = setup(config, "colors", "colorMobSpawnersLineActive", HexColor.from("#00ff00"), "Color of mob spawners activation line if spawner active.");
226         colorSlimeChunks = setup(config, "colors", "colorSlimeChunks", HexColor.from("#006000"), "Color of slime chunks bounding boxes.");
227         colorAFKSpheres = setup(config, "colors", "colorAFKSpheres", HexColor.from("#ff0000"), "Color of afk spot spheres.");
228         colorAFKSpheresSafeArea = setup(config, "colors", "colorAFKSpheresSafeArea", HexColor.from("#00ff00"), "Color of afk spot safe area spheres.");
229         colorBiomeBorders = setup(config, "colors", "colorBiomeBorders", HexColor.from("#00ff00"), "Color of biome borders.");
230         colorBeacons = setup(config, "colors", "colorBeacons", HexColor.from("#ffffff"), "Color of beacon bounding boxes.");
231         colorCustom = setup(config, "colors", "colorCustom", HexColor.from("#ffffff"), "Color of all types of custom boxes.");
232         colorConduits = setup(config, "colors", "colorConduits", HexColor.from("#00ffff"), "Color of conduit bounding spheres.");
233         colorConduitMobHarmArea = setup(config, "colors", "colorConduitMobHarmArea", HexColor.from("#ff7f00"), "Color of conduit mob harm bounding boxes.");
234         colorSpawnableBlocks = setup(config, "colors", "colorSpawnableBlocks", HexColor.from("#ff0000"), "Color of spawnable blocks.");
235 //        colorJungleTemples = setup(config, "colors", "colorJungleTemples", HexColor.from("#006000"), "Color of jungle temple bounding boxes.");
236 //        colorDesertTemples = setup(config, "colors", "colorDesertTemples", HexColor.from("#ffc800"), "Color of desert temple bounding boxes.");
237 //        colorWitchHuts = setup(config, "colors", "colorWitchHuts", HexColor.from("#0000ff"), "Color of witch hut bounding boxes.");
238 //        colorOceanMonuments = setup(config, "colors", "colorOceanMonuments", HexColor.from("#00ffff"), "Color of ocean monument bounding boxes.");
239 //        colorShipwrecks = setup(config, "colors", "colorShipwrecks", HexColor.from("#00ffff"), "Color of ship wrecks.");
240 //        colorOceanRuins = setup(config, "colors", "colorOceanRuins", HexColor.from("#00ffff"), "Color of ocean ruins.");
241 //        colorBuriedTreasure = setup(config, "colors", "colorBuriedTreasure", HexColor.from("#00ffff"), "Color of buried treasure.");
242 //        colorStrongholds = setup(config, "colors", "colorStrongholds", HexColor.from("#ffff00"), "Color of stronghold bounding boxes.");
243 //        colorMineShafts = setup(config, "colors", "colorMineShafts", HexColor.from("#c0c0c0"), "Color of mineshaft bounding boxes.");
244 //        colorNetherFortresses = setup(config, "colors", "colorNetherFortresses", HexColor.from("#ff0000"), "Color of nether fortress bounding boxes.");
245 //        colorEndCities = setup(config, "colors", "colorEndCities", HexColor.from("#ff00ff"), "Color of end cities.");
246 //        colorMansions = setup(config, "colors", "colorMansions", HexColor.from("#8b4513"), "Color of woodland mansions.");
247 //        colorIgloos = setup(config, "colors", "colorIgloos", HexColor.from("#ffffff"), "Color of igloos.");
248 //        colorPillagerOutposts = setup(config, "colors", "colorPillagerOutposts", HexColor.from("#404040"), "Color of pillager outposts.");
249 //        colorVillages = setup(config, "colors", "colorVillages", HexColor.from("#800080"), "Color of village bounding boxes.");
250 //        colorNetherFossils = setup(config, "colors", "colorNetherFossils", HexColor.from("#ffffff"), "Color of nether fossils.");
251 //        colorBastionRemnants = setup(config, "colors", "colorBastionRemnants", HexColor.from("#c0c0c0"), "Color of bastion remnants.");
252 //        colorRuinedPortals = setup(config, "colors", "colorRuinedPortals", HexColor.from("#c800ff"), "Color of ruined portals.");
253         colorFlowerForestDandelion = setup(config, "colors", "colorFlowerForestDandelion", HexColor.from("#ffff00"), "Color of Flower Forest Dandelion");
254         colorFlowerForestPoppy = setup(config, "colors", "colorFlowerForestPoppy", HexColor.from("#ff0000"), "Color of Flower Forest Poppy");
255         colorFlowerForestAllium = setup(config, "colors", "colorFlowerForestAllium", HexColor.from("#ff00ff"), "Color of Flower Forest Allium");
256         colorFlowerForestAzureBluet = setup(config, "colors", "colorFlowerForestAzureBluet", HexColor.from("#d3d3d3"), "Color of Flower Forest Azure Bluet");
257         colorFlowerForestRedTulip = setup(config, "colors", "colorFlowerForestRedTulip", HexColor.from("#ff0000"), "Color of Flower Forest Red Tulip");
258         colorFlowerForestOrangeTulip = setup(config, "colors", "colorFlowerForestOrangeTulip", HexColor.from("#ff681f"), "Color of Flower Forest Orange Tulip");
259         colorFlowerForestWhiteTulip = setup(config, "colors", "colorFlowerForestWhiteTulip", HexColor.from("#d3d3d3"), "Color of Flower Forest White Tulip");
260         colorFlowerForestPinkTulip = setup(config, "colors", "colorFlowerForestPinkTulip", HexColor.from("#ff69b4"), "Color of Flower Forest Pink Tulip");
261         colorFlowerForestOxeyeDaisy = setup(config, "colors", "colorFlowerForestOxeyeDaisy", HexColor.from("#d3d3d3"), "Color of Flower Forest Oxeye Daisy");
262         colorFlowerForestCornflower = setup(config, "colors", "colorFlowerForestCornflower", HexColor.from("#0000ff"), "Color of Flower Forest Cornflower");
263         colorFlowerForestLilyOfTheValley = setup(config, "colors", "colorFlowerForestLilyOfTheValley", HexColor.from("#ffffff"), "Color of Flower Forest Lily Of The Valley");
264         colorBedrockCeilingBlocks = setup(config, "colors", "colorBedrockCeilingBlocks", HexColor.from("#00ff00"), "Color of Bedrock Ceiling Blocks");
265         config.save();
266     }
267
268     private static Configuration loadConfiguration() {
269         Configuration config = new Configuration(new File(configDir, "BBOutlineReloaded.cfg"));
270         config.load();
271         return config;
272     }
273
274     public static void saveConfig() {
275         Configuration config = new Configuration(new File(configDir, "BBOutlineReloaded.cfg"));
276         for (Setting<?> setting : settings) {
277             config.put(setting);
278         }
279         config.save();
280     }
281
282     public static Setting<Boolean> structureShouldRender(String key) {
283         final Setting<Boolean> setting = structureRenderSettings.put(key, setup(config, "structures", "drawStructure_" + key.replace(':', '_'), true, "If set to true structure %s bounding boxes will be drawn.".formatted(key)));
284         saveConfig();
285         return setting;
286     }
287
288     public static Setting<HexColor> structureColor(String key) {
289         final Setting<HexColor> setting = structureColorSettings.put(key, setup(config, "colors", "colorStructure_" + key.replace(':', '_'), defaultStructureColors.getOrDefault(key, HexColor.from("#ffffff")), "Color if structure %s bounding boxes.".formatted(key)));
290         saveConfig();
291         return setting;
292     }
293
294     private static <T> Setting<T> setup(Configuration config, String category, String settingName, T defaultValue, String comment) {
295         Setting<T> setting = config.get(category, settingName, defaultValue);
296         setting.category = category;
297         setting.name = settingName;
298         setting.defaultValue = defaultValue;
299         if (setting.get() == null)
300             setting.reset();
301         setting.comment = comment + " (default: " + defaultValue.toString() + ")";
302         settings.add(setting);
303         return setting;
304     }
305
306     public static void Toggle(Setting<Boolean> setting) {
307         setting.set(!setting.get());
308     }
309
310     public static Set<Setting<?>> getSettings() {
311         return settings;
312     }
313 }