FileConfiguration config = plugin.getConfig();
config.options().header("CityWorld Plugin Options");
config.options().copyDefaults(true);
// get the right section
ConfigurationSection section = null;
// see if we can find the specific world
if (config.isConfigurationSection(worldname))
section = config.getConfigurationSection(worldname);
// if not then create it
if (section == null)
section = config.createSection(worldname);
/* Create a config in the world's folder
* Find the generation section
* Does the global config contain a world section?
* Load from that world section
* Copy that world section over to the generation section of the world's config
* Delete the world section in the global config
* Save the global config
* Read from the generation section
* Save the generation section
*/
// did we get a section?
if (section != null) {
// create items stacks
//===========================================================================
// set up the defaults if needed
section.addDefault(tagIncludeRoads, includeRoads);
section.addDefault(tagIncludeRoundabouts, includeRoundabouts);
section.addDefault(tagIncludeSewers, includeSewers);
section.addDefault(tagIncludeCisterns, includeCisterns);
section.addDefault(tagIncludeBasements, includeBasements);
section.addDefault(tagIncludeMines, includeMines);
section.addDefault(tagIncludeBunkers, includeBunkers);
section.addDefault(tagIncludeBuildings, includeBuildings);
section.addDefault(tagIncludeHouses, includeHouses);
section.addDefault(tagIncludeFarms, includeFarms);
section.addDefault(tagIncludeCaves, includeCaves);
section.addDefault(tagIncludeLavaFields, includeLavaFields);
section.addDefault(tagIncludeSeas, includeSeas);
section.addDefault(tagIncludeMountains, includeMountains);
section.addDefault(tagIncludeOres, includeOres);
section.addDefault(tagTreasuresInSewers, treasuresInSewers);
section.addDefault(tagSpawnersInSewers, spawnersInSewers);
section.addDefault(tagTreasuresInMines, treasuresInMines);
section.addDefault(tagSpawnersInMines, spawnersInMines);
section.addDefault(tagTreasuresInBunkers, treasuresInBunkers);
section.addDefault(tagSpawnersInBunkers, spawnersInBunkers);
section.addDefault(tagIncludeUndergroundFluids, includeUndergroundFluids);
section.addDefault(tagIncludeAbovegroundFluids, includeAbovegroundFluids);
section.addDefault(tagIncludeWorkingLights, includeWorkingLights);
section.addDefault(tagIncludeNamedRoads, includeNamedRoads);
section.addDefault(tagIncludeDecayedRoads, includeDecayedRoads);
section.addDefault(tagIncludeDecayedBuildings, includeDecayedBuildings);
section.addDefault(tagIncludeDecayedNature, includeDecayedNature);
section.addDefault(tagIncludeBuildingInteriors, includeBuildingInteriors);
section.addDefault(tagIncludeFloatingSubsurface, includeFloatingSubsurface);
section.addDefault(tagForceLoadWorldEdit, forceLoadWorldEdit);
section.addDefault(tagBroadcastSpecialPlaces, broadcastSpecialPlaces);
section.addDefault(tagTreeStyle, TreeStyle.NORMAL.name());
section.addDefault(tagCenterPointOfChunkRadiusX, centerPointOfChunkRadiusX);
section.addDefault(tagCenterPointOfChunkRadiusZ, centerPointOfChunkRadiusZ);
section.addDefault(tagConstructChunkRadius, constructChunkRadius);
section.addDefault(tagRoadChunkRadius, roadChunkRadius);
section.addDefault(tagCityChunkRadius, cityChunkRadius);
//===========================================================================
// now read the bits
includeRoads = section.getBoolean(tagIncludeRoads, includeRoads);
includeRoundabouts = section.getBoolean(tagIncludeRoundabouts, includeRoundabouts);
includeSewers = section.getBoolean(tagIncludeSewers, includeSewers);
includeCisterns = section.getBoolean(tagIncludeCisterns, includeCisterns);
includeBasements = section.getBoolean(tagIncludeBasements, includeBasements);
includeMines = section.getBoolean(tagIncludeMines, includeMines);
includeBunkers = section.getBoolean(tagIncludeBunkers, includeBunkers);
includeBuildings = section.getBoolean(tagIncludeBuildings, includeBuildings);
includeHouses = section.getBoolean(tagIncludeHouses, includeHouses);
includeFarms = section.getBoolean(tagIncludeFarms, includeFarms);
includeCaves = section.getBoolean(tagIncludeCaves, includeCaves);
includeLavaFields = section.getBoolean(tagIncludeLavaFields, includeLavaFields);
includeSeas = section.getBoolean(tagIncludeSeas, includeSeas);
includeMountains = section.getBoolean(tagIncludeMountains, includeMountains);
includeOres = section.getBoolean(tagIncludeOres, includeOres);
treasuresInSewers = section.getBoolean(tagTreasuresInSewers, treasuresInSewers);
spawnersInSewers = section.getBoolean(tagSpawnersInSewers, spawnersInSewers);
treasuresInMines = section.getBoolean(tagTreasuresInMines, treasuresInMines);
spawnersInMines = section.getBoolean(tagSpawnersInMines, spawnersInMines);
treasuresInBunkers = section.getBoolean(tagTreasuresInBunkers, treasuresInBunkers);
spawnersInBunkers = section.getBoolean(tagSpawnersInBunkers, spawnersInBunkers);
includeUndergroundFluids = section.getBoolean(tagIncludeUndergroundFluids, includeUndergroundFluids);
includeAbovegroundFluids = section.getBoolean(tagIncludeAbovegroundFluids, includeAbovegroundFluids);
includeWorkingLights = section.getBoolean(tagIncludeWorkingLights, includeWorkingLights);
includeNamedRoads = section.getBoolean(tagIncludeNamedRoads, includeNamedRoads);
includeDecayedRoads = section.getBoolean(tagIncludeDecayedRoads, includeDecayedRoads);
includeDecayedBuildings = section.getBoolean(tagIncludeDecayedBuildings, includeDecayedBuildings);
includeDecayedNature = section.getBoolean(tagIncludeDecayedNature, includeDecayedNature);
includeBuildingInteriors = section.getBoolean(tagIncludeBuildingInteriors, includeBuildingInteriors);
includeFloatingSubsurface = section.getBoolean(tagIncludeFloatingSubsurface, includeFloatingSubsurface);
forceLoadWorldEdit = section.getBoolean(tagForceLoadWorldEdit, forceLoadWorldEdit);
broadcastSpecialPlaces = section.getBoolean(tagBroadcastSpecialPlaces, broadcastSpecialPlaces);
treeStyle = TreeProvider.toTreeStyle(section.getString(tagTreeStyle, treeStyle.name()), treeStyle);
centerPointOfChunkRadiusX = section.getInt(tagCenterPointOfChunkRadiusX, centerPointOfChunkRadiusX);
centerPointOfChunkRadiusZ = section.getInt(tagCenterPointOfChunkRadiusZ, centerPointOfChunkRadiusZ);
centerPointOfChunkRadius = new Vector(centerPointOfChunkRadiusX, 0, centerPointOfChunkRadiusZ);
constructChunkRadius = Math.min(Integer.MAX_VALUE, Math.max(0, section.getInt(tagConstructChunkRadius, constructChunkRadius)));
checkConstructRange = constructChunkRadius > 0 && constructChunkRadius < Integer.MAX_VALUE;
roadChunkRadius = Math.min(constructChunkRadius, Math.max(0, section.getInt(tagRoadChunkRadius, roadChunkRadius)));
checkRoadRange = roadChunkRadius > 0 && roadChunkRadius < Integer.MAX_VALUE;
if (roadChunkRadius == 0) {
includeRoads = false;
includeSewers = false;
}
cityChunkRadius = Math.min(roadChunkRadius, Math.max(0, section.getInt(tagCityChunkRadius, cityChunkRadius)));
checkCityRange = cityChunkRadius > 0 && cityChunkRadius < Integer.MAX_VALUE;
if (cityChunkRadius == 0) {
includeCisterns = false;
includeBasements = false;
includeMines = false;
includeBunkers = false;
includeBuildings = false;
includeHouses = false;
includeFarms = false;
}
//===========================================================================
// validate settings against world style settings
validateSettingsAgainstWorldStyle(generator);
//===========================================================================
// write things back out with corrections
section.set(tagIncludeRoads, includeRoads);
section.set(tagIncludeRoundabouts, includeRoundabouts);
section.set(tagIncludeSewers, includeSewers);
section.set(tagIncludeCisterns, includeCisterns);
section.set(tagIncludeBasements, includeBasements);
section.set(tagIncludeMines, includeMines);
section.set(tagIncludeBunkers, includeBunkers);
section.set(tagIncludeBuildings, includeBuildings);
section.set(tagIncludeHouses, includeHouses);
section.set(tagIncludeFarms, includeFarms);
section.set(tagIncludeCaves, includeCaves);
section.set(tagIncludeLavaFields, includeLavaFields);
section.set(tagIncludeSeas, includeSeas);
section.set(tagIncludeMountains, includeMountains);
section.set(tagIncludeOres, includeOres);
section.set(tagTreasuresInSewers, treasuresInSewers);
section.set(tagSpawnersInSewers, spawnersInSewers);
section.set(tagTreasuresInMines, treasuresInMines);
section.set(tagSpawnersInMines, spawnersInMines);
section.set(tagTreasuresInBunkers, treasuresInBunkers);
section.set(tagSpawnersInBunkers, spawnersInBunkers);
section.set(tagIncludeUndergroundFluids, includeUndergroundFluids);
section.set(tagIncludeAbovegroundFluids, includeAbovegroundFluids);
section.set(tagIncludeWorkingLights, includeWorkingLights);
section.set(tagIncludeNamedRoads, includeNamedRoads);
section.set(tagIncludeDecayedRoads, includeDecayedRoads);
section.set(tagIncludeDecayedBuildings, includeDecayedBuildings);
section.set(tagIncludeDecayedNature, includeDecayedNature);
section.set(tagIncludeBuildingInteriors, includeBuildingInteriors);
section.set(tagIncludeFloatingSubsurface, includeFloatingSubsurface);
section.set(tagForceLoadWorldEdit, forceLoadWorldEdit);
section.set(tagBroadcastSpecialPlaces, broadcastSpecialPlaces);
section.set(tagTreeStyle, treeStyle.name());
section.set(tagCenterPointOfChunkRadiusX, centerPointOfChunkRadiusX);
section.set(tagCenterPointOfChunkRadiusZ, centerPointOfChunkRadiusZ);
section.set(tagConstructChunkRadius, constructChunkRadius);
section.set(tagRoadChunkRadius, roadChunkRadius);
section.set(tagCityChunkRadius, cityChunkRadius);
//===========================================================================
// note the depreciations
deprecateOption(section, "IncludeWoolRoads", "DEPRECATED: CityWorld now uses stained clay and quartz for roads");
deprecateOption(section, "IncludePavedRoads", "DEPRECATED: See deprecated note for IncludeWoolRoads");